node.js - nodejs connect usage of built in modules -> method not found -



node.js - nodejs connect usage of built in modules -> method not found -

when phone call node.js file

var connect = require('connect'); var app = connect(); app.use(connect.static('public')); app.listen(3000);

i get

app.use(connect.static('public')); ^ typeerror: object function createserver() { function app(req, res, next){ app.handle(req, res, next); } merge(app, proto); merge(app, eventemitter.prototype); app.route = '/'; app.stack = []; homecoming app; } has no method 'static'

using connect 3.0.1, there changes integrated modules? if yes, how work then?

big changes coming connect 3: middleware modules not included longer. find them @ github.com/expressjs. "static" "serve-static". needs installed separately with:

npm install serve-static

the above code should this:

var connect = require('connect'); var servestatic = require('serve-static'); var app = connect(); app.use(servestatic('public')); app.listen(3000);

node.js connect

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -