-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.coffee
39 lines (28 loc) · 1.18 KB
/
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
coffeeScript = require('coffee-script')
config = require('./config').settings
express = require('express')
FileRequire = require('./config/require')
fs = require('fs')
http = require('http')
https = require('https')
path = require('path')
AppRouter = require('./app/routers/app_router')
app = express()
app.configure ->
app.set "port", config.port or process.env.PORT
app.use express.compress()
app.use express.bodyParser
uploadDir: path.join(__dirname,'/public/tmp')
app.use express.methodOverride()
app.use express.cookieParser()
app.use express.session(secret: 'INSERT YOUR SESSION KEY HERE!!!' )
app.use express.logger('dev')
app.use '/js', express.static(path.join(__dirname,'/public/js'))
app.use '/css', express.static(path.join(__dirname, '/public/css'))
app.use '/img', express.static(path.join(__dirname, '/public/img'))
app.set 'view engine', 'jade'
app.set 'views', path.join(__dirname, "app/views")
FileRequire.load app, 'controllers'
server = http.createServer(app).listen app.get('port'), ->
console.log "Express server listening on port #{app.get('port')}"
appRouter = new AppRouter(app)