-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.coffee
60 lines (51 loc) · 1.67 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
# BanaJs
# author : dreampuf(soddyque@gmail.com)
#
express = require('express')
app = module.exports = express.createServer()
coffeekup = require 'coffeekup'
coffeekup.tags = coffeekup.tags.concat ["feed", "subtitle", "id", "updated", "author", "name", "rights", "entry", "content"]
config = require './config'
admin_route = require('./route/admin_route')
blog_route = require('./route/blog_route')
# Configuration
app.configure ()->
app.set 'views', __dirname + '/views'
app.set 'view engine', 'coffee'
app.set 'prodir', __dirname
app.register('.coffee', coffeekup.adapters.express)
#app.use express.compiler src: __dirname + '/public', enable: ['coffeescript']
app.use express.bodyParser()
app.use express.cookieParser()
app.use express.methodOverride()
#app.use app.router
app.use express.static(__dirname + '/public')
#app.use express.session
# key: "banajs"
# secret: "banajs"
app.use (req, res, next)->
res.local "config", config
next()
app.configure 'development', ()->
app.use express.errorHandler({ dumpExceptions: true, showStack: true })
#Session store put into third service for continue develop
MemcachedStore = require('connect-memcached')(express)
app.use express.session
secret: "banajs"
store: new MemcachedStore()
app.configure 'production', ()->
#app.use(express.errorHandler())
RedisStore = require('connect-redis')(express)
app.use express.session
key: "banajs"
secret: "banajs"
store: new RedisStore
cookie:
path: "/"
httpOnly: true
# Routes
admin_route(app)
blog_route(app)
app.listen 8081
console.log "Express server listening on port %d in %s mode", app.address().port, app.settings.env