-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
53 lines (50 loc) · 1.64 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
50
51
52
53
var user = require('./models/user');
module.exports = {
configure: function(app) {
app.get('/', function(req, res) {
res.sendFile(__dirname + '/index.html');
});
app.get('/media/:name', function(req, res) {
res.sendFile(__dirname + '/media/' + req.params.name);
});
app.post('/login', function(req, res) {
user.login(req.body, res);
});
app.get('/user/', function(req, res) {
user.getAll(res);
});
app.post('/user/', function(req, res) {
user.create(req.body, res);
});
app.get('/user/:id', function(req, res) {
user.get(req.params.id, res);
});
app.get('/user/:id/friends/', function(req, res) {
user.getFriends(req.params.id, res);
});
app.put('/user/:id/nickname', function(req, res) {
user.updateNickname(req.params.id, req.body, res);
});
app.put('/user/:id/email', function(req, res) {
user.updateEmail(req.params.id, req.body, res);
});
app.put('/user/:id/password', function(req, res) {
user.updatePassword(req.params.id, req.body, res);
});
app.put('/user/:id/image', function(req, res) {
user.updateAvatar(req.params.id, req.body, res);
});
app.put('/user/:id/subnick', function(req, res) {
user.updateSubnick(req.params.id, req.body, res);
});
app.put('/user/:id/nickname_style', function(req, res) {
user.updateNicknameStyle(req.params.id, req.body, res);
});
app.put('/user/:id/msg_style', function(req, res) {
user.updateMsgStyle(req.params.id, req.body, res);
});
app.put('/user/:id/state', function(req, res) {
user.updateState(req.params.id, req.body, res);
});
}
};