+ /schedules route; other update

This commit is contained in:
tmshv committed 2015-08-05 00:51:39 +03:00
1 parent dc88c838aa
commit a22820c278
1 file changed
+16
+16
View File
@@ -44,4 +44,20 @@ module.exports = function (app) {
}
))
);
app.use(
route.get("/schedules", router.accepts(
{
"text/html": router.index(),
"text/plain": router.index(),
"application/json": function *() {
this.type = "application/json";
var data = yield db.c("schedules").find({}, {period:1 , semester: 1}).toArray();
if(!data) this.status = 404;
else this.body = data;
}
}
))
);
};