node.js - express.js share routes to render page in different way -


i have written page called sponsorcenter, need control 2 routes:

app.get('/sponsorcenter',function(req, res){});  app.get('/sponsorcenter/all',function(req, res){}); 

the header, footer , right columns same. when change url, left column change.

so question can use 1 route judge different access , render page? because left column different, think not necessary render other parts via route.

yes can accept route parameter variable. same variable accessible controller in request req parameter.

app.get('sponsorcenter/:type*?', function(req, res) {     console.log(req.params.type); }); 

this match routes sponsorcenter, sponsorcenter/all, sponsorcenter/admin, sponsorcenter/user1 etc.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -