express = require 'express'
gzippo = require 'gzippo'
app = express.createServer express.logger()
store = new express.session.MemoryStore
api = require './api/apis'
tmpl =
compile: (source, options)->
(locals)->
source
app.configure ()->
app.set 'views', "#{__dirname}/public"
app.use express.cookieParser()
app.use express.session secret: '<sessionkey>', store: store
app.use gzippo.staticGzip "#{__dirname}/public"
app.set 'view options', layout: false
app.set 'view engine', 'html'
app.register '.html',
tmpl
# APIs
app.post '/api/auth/login', api.login
app.get '/api/auth/logout', api.logout
app.get '*', (request, response) ->
response.render "index.html"
port = process.env.PORT || 3000
app.listen port, ()->
console.log "Listening on " + port
댓글
댓글 쓰기