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:
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
Post a Comment