diff --git a/backend/Makefile b/backend/Makefile index 4f798d0..378cc66 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -13,4 +13,4 @@ dev: .PHONY: start start: dev - node dist/backend/src/main.js + node dist/bundle.js diff --git a/backend/src/main.ts b/backend/src/main.ts index 6f45e5b..4feb5bf 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -39,19 +39,22 @@ authRouter.get("/class/:id/topTen", async (req, res) => { } console.log("Stub: /auth/class/:id/topTen"); + + let users: any[] = []; + let nr = 10; + for (let i = 0; i < 10; i++) + users = users.concat({ + username: `Test User ${i}`, + score: 100 * i, + level: Math.floor(Math.random() * Math.floor(10)), + nr: nr--, + }); + // TODO: Implement res.send({ error: "0", data: { - topTen: [{ - username: "User1", - level: 5, - score: 200, - }, { - username: "User2", - level: 4, - score: 100, - }], + topTen: users, } }); }); @@ -86,6 +89,20 @@ authRouter.get("/level/:id/vocab", async (req, res) => { } }); }); +authRouter.get("/user/nextLevel", async (req, res) => { + console.log("Stub: /auth/user/nextLevel"); + + res.send({ + error: "0", + data: { + name: "Test level", + desc: "Just a test", + level: 3, + + done: false, + }, + }); +}); const app = express(); app.use(bodyparser.json());