Sanjay B
Sanjay B

Reputation: 211

Combining Different Modules in NodeJs

I have Created Separate Working Modules in nodejs

I want to combine them all. Like after getting successful login i want it to redirect to chat module. Right now i can redirect to static html page after login.

app.post('/login', passport.authenticate('local-login', {
        successRedirect : '/profile', // redirect to the secure profile section
        failureRedirect : '/login', // redirect back to the signup page if there is an error
        failureFlash : true // allow flash messages
    }));

Note: Now If i have to run any module i have to compile it individually and run it on localhost.

Upvotes: 0

Views: 122

Answers (1)

rajatgupta431
rajatgupta431

Reputation: 121

Assuming that you are using Express Framework, for the successRedirect , instead of redirecting the user to '/profile' route, redirect him to (lets say) '/chat' and define the app.get('/chat,callback) route in the same file , or export your chat module and require it in the file that you are using for authentication/login

Upvotes: 1

Related Questions