Pob Livsig
Pob Livsig

Reputation: 105

Using PassportJS LocalStrategy in Node.js and trying to create a User object

Inside the LocalStrategy function I am trying to create a new user that I can pass-back with:

var newUser = new User();

and I am getting this error

TypeError:  object is not a function 

I can't seem to find the what has the definition for User()

Any ideas?

Upvotes: 0

Views: 102

Answers (1)

Ben
Ben

Reputation: 7597

passport has no definition for User, per se. It sounds to me as if you might want to make use of a schema or similar kind of model.

For example, if your back-end is based on MongoDB, the mongoose project offers schema definitions, amongst other things. With mongoose you can set up a User object definition (i.e. schema), and then make use of it like so:

var user = app.db.models.User.findOne( {...})

Upvotes: 1

Related Questions