diff --git a/src/routes/collective.js b/src/routes/collective.js index 1b1d277f..7c6be66a 100644 --- a/src/routes/collective.js +++ b/src/routes/collective.js @@ -4,20 +4,18 @@ import db from '../core/db'; import {getCourseNameByID} from '../models/course'; import team from '../models/team'; -export default function (app) { - app.use( - route.get('/collective', json( - function *() { - this.type = 'application/json'; +export default function () { + return route.get('/collective', json( + function *() { + this.type = 'application/json'; - let data = yield db.c('collective').find(); - if (!data) { - this.status = 404; - return; - } - - this.body = data; + let data = yield db.c('collective').find(); + if (!data) { + this.status = 404; + return; } - )) - ); + + this.body = data; + } + )) }; diff --git a/src/server.js b/src/server.js index 1976e551..8356e493 100644 --- a/src/server.js +++ b/src/server.js @@ -53,5 +53,5 @@ gallery(app); instagram(app); instagramIO(app); documents(app); -collective(app); +app.use(collective()); app.use(error404()); \ No newline at end of file