JJuOn

Add new routes

...@@ -7,6 +7,7 @@ const notify = require("./notify"); ...@@ -7,6 +7,7 @@ const notify = require("./notify");
7 const user = require("./user"); 7 const user = require("./user");
8 const profile = require("./profile"); 8 const profile = require("./profile");
9 const challenge = require("./challenge"); 9 const challenge = require("./challenge");
10 +const session = require("./session");
10 11
11 api.use("/auth", auth.routes()); 12 api.use("/auth", auth.routes());
12 api.use("/friend", friend.routes()); 13 api.use("/friend", friend.routes());
...@@ -14,5 +15,6 @@ api.use("/notify", notify.routes()); ...@@ -14,5 +15,6 @@ api.use("/notify", notify.routes());
14 api.use("/user", user.routes()); 15 api.use("/user", user.routes());
15 api.use("/profile", profile.routes()); 16 api.use("/profile", profile.routes());
16 api.use("/challenge",challenge.routes()); 17 api.use("/challenge",challenge.routes());
18 +api.use("/session",session.routes());
17 19
18 module.exports = api; 20 module.exports = api;
......
1 +const Router = require('koa-router');
2 +const session = new Router();
3 +const sessionCtrl = require('./session.ctrl');
4 +
5 +session.post("/createproblem/:how",sessionCtrl.createProblem);
6 +
7 +module.exports = session;
...\ No newline at end of file ...\ No newline at end of file
1 +/* POST /api/session/createproblem/:how
2 +{
3 + problemList:[Number]
4 +}
5 +*/
6 +exports.createProblem = async (ctx)=>{
7 + try{
8 + const how=ctx.params.how;
9 + if(how==='self'){
10 +
11 + }
12 + else if(how==='recommend'){
13 +
14 + }
15 + }
16 + catch(e){
17 + ctx.throw(500,e);
18 + }
19 +};
...\ No newline at end of file ...\ No newline at end of file