forked from brikis98/node-backbone-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
35 lines (35 loc) · 1.07 KB
/
server.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
(function() {
var Settings, Watcher, app, express, path, settings, templates, watcher, _;
express = require('express');
path = require('path');
_ = require('underscore');
Watcher = require('./util/watcher').watcher;
Settings = require('settings');
templates = {};
settings = new Settings(path.join(__dirname, 'config/environment.js')).getEnvironment();
watcher = new Watcher(settings.watcherOptions, templates);
watcher.compileTemplates();
app = express.createServer();
app.configure(function() {
app.use(express.errorHandler(settings.errorHandling));
app.use(express.static(settings.publicDir, {
maxAge: settings.staticMaxAge
}));
app.use(express.bodyParser());
app.use(express.cookieParser({
maxAge: settings.cookieMaxAge
}));
return app.use(express.session({
secret: settings.cookieSecret
}));
});
app.configure('development', function() {
return watcher.watch();
});
app.get('/', function(req, res) {
return res.send(templates['index']({
name: 'Jim'
}));
});
app.listen(8003);
}).call(this);