forked from component/todo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
38 lines (29 loc) · 757 Bytes
/
app.js
File metadata and controls
38 lines (29 loc) · 757 Bytes
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
/**
* Module dependencies.
*/
var express = require('express')
, build = require('./server/build')
, items = require('./server/items')
, app = express();
// configure
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.static(__dirname + '/build'));
});
// items
app.get('/item/all', items.all);
app.post('/item', items.create);
app.put('/item/:id', items.update);
app.del('/item/:id', items.remove);
// catch-all
app.all('*', build, function(req, res){
// res.sendfile('index.html');
res.render('index');
});
// bind
app.listen(3000);
console.log('listening on 3000');