node.js - Cannot call method 'use' of undefined -


i have problem implementing passport in node.js express.

i trying follow different guides, won't succeed..

this time theres error this:

enter image description here

my code looks this:

in app.js:

var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser');  // configuring passport var passport = require('passport'); var expresssession = require('express-session'); // todo - why need key ? app.use(expresssession({secret: 'mysecretkey'})); app.use(passport.initialize()); app.use(passport.session()); 

any idea why wont work? have installed express-session, passport, passport-local etc.

you need initialize app express()

  var express= require('express');     var app=express(); 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -