This repository has been archived by the owner on Aug 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
routes.js
49 lines (41 loc) · 1.4 KB
/
routes.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
48
49
module.exports = function(app) {
// pass the app into each controller
var index = require('./controllers/index')(app);
var user = require('./controllers/users')(app);
var board = require('./controllers/boards')(app);
var invitations = require('./controllers/invitations');
app.get('/', board.list);
// user
app.all('/users', user.list);
app.all('/users/:id/:op?', user.load);
app.get('/users/:id', user.view);
app.get('/users/:id/view', user.view);
app.get('/users/:id/edit', user.edit);
app.put('/users/:id/edit', user.update);
// board
app.get('/boards', board.list);
app.post('/boards', board.create);
app.get('/boards/:id.:format', board.show);
app.get('/boards/:id', board.show);
app.post('/boards/:id.:format/moves', board.play);
// invitations
app.get('/invitations/:id', invitations.show);
function NotFound(msg){
this.name = 'NotFound';
Error.call(this, msg);
Error.captureStackTrace(this, arguments.callee);
}
// Error handling
// https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x
/*
app.use(function(err, req, res, next){
// Log the error to Airbreak if available, good for backtracking.
console.log(err);
//if (airbrake) { airbrake.notify(err); }
if (err instanceof NotFound) {
res.render('errors/404', {status: 404});
} else {
res.render('errors/500', {error: err, status: 500});
}
});*/
}