forked from brikis98/node-backbone-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.coffee
28 lines (21 loc) · 842 Bytes
/
server.coffee
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
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 ->
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
app.use express.session secret: settings.cookieSecret
app.configure 'development', ->
watcher.watch()
app.get '/', (req, res) ->
res.send templates['index']({name: 'Jim'})
app.listen 8003