Sunday, 11 June 2017

Logger is not a function error in Node.js

As in my previous questions I said, I am trying to create an HTTP server, testing some middlewares codes, but in my code right now is giving basically the same error from another times, but I can't see where I am getting this wrong.

My code :

logger.js

var http = require('http');
var connect = require('connect');
var app = connect();
// setup logger middleware
app.use(connect.logger());
// actually respond
app.use(function(req, res) {
res.end('Hello World!');
});
http.createServer(app).listen(8080);

He points out to the connect.logger() even if I am using app.use(), still gives me this error.

connect.logger is not a function



via Monteiro

No comments:

Post a Comment