-
Notifications
You must be signed in to change notification settings - Fork 2
/
routes.js
47 lines (37 loc) · 1.58 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
/**
* Created by stephen on 11/10/13.
*/
var api = require('./api');
exports = module.exports = function(app){
// user REST
app.get('/', api.index );
// rest users
app.get('/users',require('./api/users').list) ;
// user with id
app.get('/users/:userId',require('./api/users').get) ;
// add a new user
app.post('/users',require('./api/users').post) ;
//creating a put for updates , but mongo save will also update so we are using the same call
app.put('/users',require('./api/users').put) ;
// now the scary method :( delete
app.delete('/users/:userId',require('./api/users').delete) ;
// Communications
app.get('/communication/',require('./api/communications').list) ;
// user with id
app.get('/communication/:commId',require('./api/communications').get) ;
// add a new user
app.post('/communication',require('./api/communications').post) ;
//creating a put for updates , but mongo save will also update so we are using the same call
app.put('/communication',require('./api/communications').post) ;
// now the scary method :( delete
app.delete('/communication/:commId',require('./api/communications').delete) ;
// contacts
app.get('/contact/',require('./api/contacts').list) ;
// user with id
app.get('/contact/:commId',require('./api/contacts').get) ;
// add a new user
app.post('/contact/',require('./api/contacts').post) ;
app.put('/contact/',require('./api/contacts').put) ;
// now the scary method :( delete
app.delete('/contact/:contactId',require('./api/contacts').delete) ;
}