-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.js
47 lines (35 loc) · 798 Bytes
/
router.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const matches = require("./features/matches");
const ranking = require("./features/ranking");
/**
* @param {import("fastify").FastifyInstance} fastify
*/
module.exports = async (fastify, options) => {
fastify.get("/version", async (request, reply) => {
return {
v: "0.0.1"
}
});
fastify.route({
method: "POST",
url: "/newMatch",
schema: matches.post_newMatch_schema,
handler: matches.post_newMatch,
});
fastify.route({
method: "GET",
url: "/match/:_id",
handler: matches.get_match,
});
fastify.route({
method: "PUT",
url: "/match",
schema: matches.put_match_schema,
handler: matches.put_match,
});
fastify.route({
method: "GET",
url: "/ranking/:username?",
schema: ranking.get_ranking_schema,
handler: ranking.get_ranking,
});
};