Reputation: 1089
I been trying to find dynamic navigation pluging for Express JS 4.0. Is there any dynamic navigation builder which works with passport.
Basic idea is this
Is there any ready made solutions or do I need to add code to include different nav.ejs templates if user is logged in
Upvotes: 0
Views: 388
Reputation: 141
I use handlebars as my view-engine so the helpers are going to be different, but what i did was to add a usergroup field to the user, then in the response, pass the usergroup to the render and do something like this with a custom helper
<a href='/'>Home</a>
{{if user.usergroup value=admin}}<a href='/cPanel'>Admin</a>{{/if}}
{{if user.usergroup value=user}}<a href='/Forum'>Forum</a>{{/if}}
Upvotes: 1