forked from urban/sharesheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (26 loc) · 828 Bytes
/
app.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
/**
* Module dependencies.
*/
var express = require('express');
var build = require('./server/build');
var spreadsheets = require('./server/spreadsheets');
var app = express();
var port = process.env.PORT || 3000;
// configure
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.static(__dirname + '/build'));
// spreadsheets
app.get('/api/v1/spreadsheet/all', spreadsheets.all);
app.get('/api/v1/spreadsheet/:id', spreadsheets.show);
// app.post('/api/v1/spreadsheet', spreadsheets.create);
app.put('/api/v1/spreadsheet/:id', spreadsheets.update);
// app.del('/api/v1/spreadsheet/:id', spreadsheets.remove);
// catch-all
app.all('*', build, function(req, res) {
res.sendfile('index.html');
});
// bind
app.listen(port);
console.log('listening on %d', port);