node.js - No response from simple Expressjs app -


I'm upgrading a little bit at expressjs 4.0. The request for very simple code below http: // localhost: 3000 / is hanging and does not fix anything to rearrange things, however, if I use cookies-parser, body-parser And commenting app.use () statement for the Express-session, it works. Obviously I need them so there is no alternative to comment except for them.

I know that I am doing something wrong which is very simple but I can not see it. Can someone give me a nudger handkerchief in the right direction?

  var express = required ('express'), cookie = required ('cookie-parser'), body = required ('body-parser'), session = Required ('Express-session'), requires http = ('http'); var app = express (); var router = express.routor (); app.use (cookie); app.use (body); app.use (session ({secret: 'BigSerket'})); Router.get ('/', function (rike, ridge, next) {res.send ('welcome');}); app.use (router); app.set ('port', process.env.port || 3000); Http.createServer .listen (app.get ('port'), function () {console.log ('listen to express server on port' + app.get ('port'));}; Mediumware must be passed as a function invocation:  
   

app.use (cookie); app.use (body);

should be

  app. (Cookie) ()); app.use (body ());    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -