3

This is one of my first stack overflow questions, so I'll try to do my best in asking my question..

I'm following this tutorial exactly ( http://scotch.io/tutorials/javascript/easy-node-authentication-setup-and-local ) and after the third part ( "Application Setup server.js) when I try to run the server I get "TypeError: object is not a function" for the line:

require('./app/routes.js')(app, pspt); // load our routes and pass in our app

I found other people having similar problems that were caused by naming conflicts with local variables. I tried renaming passport to pspt but it seems like the error was found at the start of the second parenthesis, before my variables. Should I rename the 'app/routes' folder?

Thanks!

EDIT: Yeah, the tutorial made it seem like it should work right after the third part. I moved onto the fourth part and it worked fine. Thanks again.

3
  • What is the source of /app/routes.js? Commented Apr 22, 2014 at 21:12
  • the problem is in your routes.js. possibly a syntax error? you should post the routes.js code. Commented Apr 22, 2014 at 21:18
  • your routes.js should be a big function that takes 2 params (app, pspt) and inside you define the rest of the callbacks. If your routes.js is just a module, then the error is legit. Commented Apr 22, 2014 at 21:23

1 Answer 1

5

Make sure your ./app/routes.js module returns a function. It should be something like:

module.exports = function(app, passport) {
    //...
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.