Skip to content

Instantly share code, notes, and snippets.

@thihenos
Created July 13, 2018 19:20
Show Gist options
  • Save thihenos/f485cdc961f1bfe9667b70173bd775a3 to your computer and use it in GitHub Desktop.
Save thihenos/f485cdc961f1bfe9667b70173bd775a3 to your computer and use it in GitHub Desktop.
//Here, I isolate one Route in the file route/application
let application = require('./routes/application');
/* Secured Route
* First, the app will enter in routes/application, so there you can create any validation you want, and use the NEXT function for Node enter in the function that will
* render the page secured
* Following the logic, you can create a lot of routes before it goes to the final rendering HTML
* Example: app.get('/home', route1, route2, route3, routefinal);
*/
app.get('/home',application.IsAuthenticated,function(req,res){
res.render('welcome/home');
});
/* No Secured Route
* as you can see, we ar just calling the render page, whitout validanting the requisition
*/
app.get('/homeNoSecure',function(req,res){
res.render('welcome/homeNoSecure');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment