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 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? should be 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.
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. (Cookie) ()); app.use (body ());
Comments
Post a Comment