-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
44 lines (35 loc) · 1.25 KB
/
app.js
File metadata and controls
44 lines (35 loc) · 1.25 KB
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
/* jslint node: true */
"use strict";
var app, express;
express = require('express');
app = express();
app.configure(function () {
app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */
app.use(express.static('public'));
app.use(express.bodyParser());
});
//register
app.get('/register', require('./controllers/user_auth').register);
//authenticate before anything else
app.all('*', require('./controllers/user_auth').auth_user);
//default:
app.get('/', require('./controllers/lists').getLists);
//get lists
app.get('/lists', require('./controllers/lists').getLists);
//get list
app.get('/lists/:id', require('./controllers/lists').getById);
//new list
app.post('/lists', require('./controllers/lists').add);
//update list
app.put('/lists/:id', require('./controllers/lists').update);
//delete list
app.delete('/lists/:id', require('./controllers/lists').remove);
//get list item
app.get('/items/:item_id', require('./controllers/list_items').getById);
//add list item
app.post('/lists/:id/items', require('./controllers/list_items').add);
//update list item
app.put('/items/:item_id', require('./controllers/list_items').update);
//delete list item
app.delete('/items/:item_id', require('./controllers/list_items').remove);
app.listen(3000);