FAQ Database Discussion Community


How to best structure an Express V4.11+ project with Socket.IO?

node.js,express,socket.io,socket.io-1.0,express-4
I've used the latest version of the express-generator (link) to generate a boilerplate Express 4.11.2 project. I'm trying to figure out the best way of setting up Socket.IO 1.3.3 with the changes that have been made a few major versions back in the Express framework, where the http server was...

Express-session defined in one route file not available in app.js Node JS

javascript,node.js,express-4,express-session
I have issue with express-session in node js and express 4. I set a session variable inside routes/index.js and is not available in app.js.But available on another route file users.js routes/index.js var sess; router.get('/setsession',function(req,res){ sess=req.session; sess.username="safeer"; res.send("hi "+sess.username); }); router.get('/getsession',function(req,res){ sess=req.session; res.send("hi "+sess.username); //here session value available }); routes/users.js var...

MongoDB and Express: Type Error: Converting Circular structure to JSON

javascript,node.js,mongodb,visual-studio-2013,express-4
I am new to MEAN stack. I am trying to retreive a list of documents from MongoDB. I have used Visual Studio 2013 community edition to create a basic Nodejs Express application. Visual studio created app.js file on the root for configuration. I have put following code in app.js which...

How can run app using Express 4 without “DEBUG=node:* ./bin/www”

node.js,express,phpstorm,express-4
I'm learning Node.js + Express 4 and command that running my app looks so: $>DEBUG=node:* ./bin/www And what is this command do ? How can I run my app like this: $>node app.js PS: I need to run under phpStrom and can't set in configuration first command....

Simple Error: Express 3 -> 4. Moving a controller and requesting index “Route.get() requires callback functions but got a [object Undefined]”

node.js,express,controller,express-4
Hi I've seen similar errors, but none of them apply to this circumstance. I'm working through the Getting Mean book but applying all the lessons on Express 3 to an Express 4 app. In app.js app.set('views', path.join(__dirname, 'app_server/views')); //index.jade is located here and confirmed to work before moving controller ......