-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.js
46 lines (42 loc) · 1.71 KB
/
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
'use strict';
const Router = require('koa-router');
const router = new Router();
const userController = require('./controllers/user.controller');
const leagueController = require('./controllers/league.controller');
const sportsController = require('./controllers/sports.controller');
const opponentController = require('./controllers/opponent.controller');
const matchController = require('./controllers/match.controller');
const ulController = require('./controllers/users-leagues.controller');
const statsController = require('./controllers/stats.controller');
const locationController = require('./controllers/location.controller');
router
.get('/users/:id', userController.getUser)
.post('/users', userController.postUser)
.get('/login', userController.login, userController.getUser)
.get('/sports', sportsController.getSports)
.get('/:cityName/leagues', leagueController.getLeagues)
.get('/:cityName/leagues/:leagueId', leagueController.getLeague)
.post('/:cityName/leagues/:leagueId/join', ulController.join)
.get('/opponent/:leagueId/:userId', opponentController.getOpponent)
.post('/versus', matchController.createMatch,matchController.getMatch)
.get('/users/:userId/:cityName/matches', matchController.getMatches)
.post(
'/matches/:matchId/set',
matchController.setDetails,
matchController.getMatch
)
.put(
'/matches/:matchId/:action',
matchController.changeStatus,
matchController.getMatch
)
.post(
'/matches/:matchId/:action',
matchController.changeStatus,
ulController.setNewElo,
statsController.updateStats,
matchController.finishMatch,
matchController.getMatch
)
.post('/requestLocation/', locationController.getLocation);
module.exports = router;