First of all, this is an integration case problem where I want to integrate existing code coming from other apps, also new code.
Context
I have a complete working Mongoose/Passport/Express application working correctly. I also developed externally and complete CRUD application that I want to integrate adding the new endpoint to passport's authentication. Integration with the main application was done successfully, however, the new endpoint is not being authenticated as expected.
The question could potentially simple for advanced users, I'm not in this technology. What I'm looking for is to know which is the best practice to develop a CRUD application that should be merged into an existing running application with passport considering the new application has its own route/controller/view model. (I already know some refactoring is required)
Problem
For the existing application, I can validate the new endpoint just adding to router.js the following :
app.get('/mergegeopoint', isLoggedIn, function(req, res){
res.render('mergegeopoint/index.ejs', { user: req.user });
});
The previous code works if I drop "app.use('/mergegeopoints', mergegeopoints);" from server.js but fails after validation with the output:
"mergegeopoint is not defined" GET /mergegeopoint 500 5.225 ms - 2939
This seems to be correct because it was dropped from Server.js, if I uncomment it works but passport does not validate the new endpoint so I can call the /mergegeopoint skipping passport authorization.
I could not find related documents about how to integrate it well following a best practice, so just point me there if this example of integration exist somewhere. There are tons of information but not concrete sceneries where you should integrate other developments that have their own controllers, routes, views, etc.
Thanks in advance.
via Joe V.
No comments:
Post a Comment