+ collective route

This commit is contained in:
tmshv committed 2016-02-24 18:02:09 +03:00
1 parent 54a6bddf90
commit 5244beecf8
1 file changed
+23
+23
View File
@@ -0,0 +1,23 @@
import route from 'koa-route';
import {json} from './';
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';
let data = yield db.c('collective').find();
if (!data) {
this.status = 404;
return;
}
this.body = data;
}
))
);
};