forked from alfrednerstu/node-express-coffeescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.coffee
41 lines (31 loc) · 861 Bytes
/
app.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
29
30
31
32
33
34
35
36
37
38
39
40
41
connect = require 'connect'
express = require 'express'
jade = require 'jade'
app = module.exports = express.createServer()
# CONFIGURATION
app.configure(() ->
app.set 'view engine', 'jade'
app.set 'views', "#{__dirname}/views"
app.use connect.bodyParser()
app.use connect.static(__dirname + '/public')
app.use express.cookieParser()
app.use express.session({secret : "shhhhhhhhhhhhhh!"})
app.use express.logger()
app.use express.methodOverride()
app.use app.router
)
app.configure 'development', () ->
app.use express.errorHandler({
dumpExceptions: true
showStack : true
})
app.configure 'production', () ->
app.use express.errorHandler()
# ROUTES
app.get '/', (req, res) ->
res.render 'index',
locals:
title: 'Hello World!'
# SERVER
app.listen(1234)
console.log "Express server listening on port #{app.address().port}"