Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update app.js

  • Loading branch information...
commit d90ab934fef6cdaff29d50d413ca58d772963b44 1 parent bc9a437
@Oleg2tor Oleg2tor authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  app.js
View
2  app.js
@@ -87,7 +87,7 @@ app.configure(function() {
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(connectTimeout({ time: 10000 }));
- app.use(express.session({ store: mongoStore(app.set('db-uri')), secret: 'topsecret' }));
+ app.use(express.session({ store: new mongoStore(app.set('db-uri')), secret: 'topsecret' }));
app.use(express.logger({ format: '\x1b[1m:method\x1b[0m \x1b[33m:url\x1b[0m :response-time ms' }))
app.use(express.methodOverride());
app.use(stylus.middleware({ src: __dirname + '/public' }));

1 comment on commit d90ab93

@MrRyanAlexander

I had to revert back to the previous commit for this to work on my machine. I kept getting :

This error occured running app.js in NODE_ENV=test
TypeError: Cannot call method 'findOne' of null
at MongoStore.MONGOSTORE.get (/home/pminus/Code/projects/homepage/nodepad/node_modules/connect-mongodb/lib/connect-mongodb.js:114:15)
at Object.session as handle

This error occurred running app in NODE_ENV=production & NODE_ENV=development
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (http.js:704:11)
at ServerResponse.res.setHeader (/home/pminus/Code/projects/homepage/nodepad/node_modules/connect/lib/patch.js:62:20)
at next (/home/pminus/Code/projects/homepage/nodepad/node_modules/connect/lib/http.js:165:13)
at pass (/home/pminus/Code/projects/homepage/nodepad/node_modules/express/lib/router/index.js:219:24)
at nextRoute (/home/pminus/Code/projects/homepage/nodepad/node_modules/express/lib/router/index.js:209:7)
at callbacks (/home/pminus/Code/projects/homepage/nodepad/node_modules/express/lib/router/index.js:274:11)
at callbacks (/home/pminus/Code/projects/homepage/nodepad/node_modules/express/lib/router/index.js:277:9)
at callbacks (/home/pminus/Code/projects/homepage/nodepad/node_modules/express/lib/router/index.js:277:9)
at callbacks (/home/pminus/Code/projects/homepage/nodepad/node_modules/express/lib/router/index.js:277:9)
at callbacks (/home/pminus/Code/projects/homepage/nodepad/node_modules/express/lib/router/index.js:277:9)

Everything is working when I swap the call to new mongoStore() for mongoStore()
screenshot from 2013-11-26 14 06 03

Please sign in to comment.
Something went wrong with that request. Please try again.