back to git connect-mongo, non-callback mongostore

This commit is contained in:
Tyler Renelle 2012-12-31 12:39:28 -05:00
parent 4b8e1c82a0
commit 04154ae08a
2 changed files with 34 additions and 38 deletions

View file

@ -11,7 +11,7 @@
"derby-auth": "git://github.com/lefnire/derby-auth#master",
"forever-monitor": "*",
"connect-mongo": "*",
"connect-mongo": "git://github.com/kcbanner/connect-mongo#master",
"passport-facebook": "*",
"express": "*",
"gzippo": "*",

View file

@ -51,45 +51,41 @@ options =
allowPurl: true
schema: require('../app/schema').newUserObject()
# use async callback for initializing app, to make sure we're connected to the database before initting app
# this avoids 'arbiterOnly' error (see http://goo.gl/Vs6lW)
mongo_store = new MongoStore {url: process.env.NODE_DB_URI}, ->
expressApp
.use(express.favicon())
# Gzip static files and serve from memory
.use(gzippo.staticGzip publicPath, maxAge: ONE_YEAR)
# Gzip dynamically rendered content
.use(express.compress())
expressApp
.use(express.favicon())
# Gzip static files and serve from memory
.use(gzippo.staticGzip publicPath, maxAge: ONE_YEAR)
# Gzip dynamically rendered content
.use(express.compress())
# Uncomment to add form data parsing support
.use(express.bodyParser())
.use(express.methodOverride())
# Uncomment to add form data parsing support
.use(express.bodyParser())
.use(express.methodOverride())
# Uncomment and supply secret to add Derby session handling
# Derby session middleware creates req.session and socket.io sessions
.use(express.cookieParser())
.use(store.sessionMiddleware
secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE'
cookie: {maxAge: ONE_YEAR}
store: new MongoStore {url: process.env.NODE_DB_URI}
)
# Uncomment and supply secret to add Derby session handling
# Derby session middleware creates req.session and socket.io sessions
.use(express.cookieParser())
.use(store.sessionMiddleware
secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE'
cookie: {maxAge: ONE_YEAR}
store: mongo_store
)
# Adds req.getModel method
.use(store.modelMiddleware())
# Middelware can be inserted after the modelMiddleware and before
# the app router to pass server accessible data to a model
.use(priv.middleware)
.use(habitrpgMiddleware)
.use(auth(store, strategies, options))
# Creates an express middleware from the app's routes
.use(app.router())
.use(expressApp.router)
.use(serverError root)
# Adds req.getModel method
.use(store.modelMiddleware())
# Middelware can be inserted after the modelMiddleware and before
# the app router to pass server accessible data to a model
.use(priv.middleware)
.use(habitrpgMiddleware)
.use(auth(store, strategies, options))
# Creates an express middleware from the app's routes
.use(app.router())
.use(expressApp.router)
.use(serverError root)
priv.routes(expressApp)
require('./serverRoutes')(expressApp, root, derby)
priv.routes(expressApp)
require('./serverRoutes')(expressApp, root, derby)
# Errors
expressApp.all '*', (req) ->
throw "404: #{req.url}"
# Errors
expressApp.all '*', (req) ->
throw "404: #{req.url}"