sync/src/web/routes/index.js

20 lines
539 B
JavaScript
Raw Normal View History

2015-10-26 22:56:53 -07:00
import { sendJade } from '../jade';
export default function initialize(app, channelIndex) {
app.get('/', (req, res) => {
channelIndex.listPublicChannels().then((channels) => {
channels.sort((a, b) => {
if (a.usercount === b.usercount) {
return a.uniqueName > b.uniqueName ? -1 : 1;
}
return b.usercount - a.usercount;
});
sendJade(res, 'index', {
channels: channels
});
});
});
}