-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.coffee
28 lines (22 loc) · 841 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
express = require 'express'
path = require 'path'
fs = require 'fs'
config = require "#{__dirname}/config/#{process.env.NODE_ENV}.json"
app = express()
# redirect stderr to configured log file
if config.application.error_log_file?
console.log "Errors will be logged in #{config.application.error_log_file}"
stderr = fs.createWriteStream(config.application.error_log_file, { flags: 'a' })
process.__defineGetter__("stderr", () -> return stderr)
app.configure ->
app.set 'port', config.application.port
app.set 'host', config.application.host
app.set 'view options',
layout: true
app.use express.logger('dev')
app.use express.bodyParser()
app.use express.methodOverride()
# app.use express.cookieParser("secret")
# app.use app.router
app.use express.static(path.join(__dirname, '/public'))
exports.app = app