-
Notifications
You must be signed in to change notification settings - Fork 11
/
app.js
38 lines (30 loc) · 1.01 KB
/
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
37
38
var Express = require('express');
var Routes = require('./routes');
// var TryCatch = require('./trycatch');
var App = Express();
// Configuration
App.configure(function(){
App.set('views', __dirname + '/views');
App.set('view engine', 'jade');
// This gives us scoped errors with long stack traces
// App.use(function (req, res, next) {
// TryCatch(next, next);
// });
App.use(Express.bodyParser());
App.use(Express.methodOverride());
App.use(App.router);
App.use(Express.static(__dirname + '/public'));
});
App.configure('development', function(){
App.use(Express.errorHandler({ dumpExceptions: true, showStack: true }));
});
App.configure('production', function(){
App.use(Express.errorHandler());
});
// Routes
App.get('/', Routes.index);
App.get('/:name', Routes.view);
App.get('/:name/edit', Routes.edit);
App.post('/:name', Routes.save);
server = App.listen(process.env.PORT || 3000);
console.log("Express server listening on port %d in %s mode", server.address().port, App.settings.env);