joshuaalpuerto / node-ddd-boilerplate

Node DDD Boilerplate

Home Page:https://joshuaalpuerto.github.io/node-ddd-boilerplate/#/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Whitelisting routes

BilalHasanKhan opened this issue · comments

commented

Please pardon my ignorance but what's the best way in this to whitelist the routes which do not need authentication like say /register

Hey @BilalHasanKhan

I assume you put the /register route under user module.

You can follow this step

// comment the module level authentication
// router.use(auth.authenticate()) 

  router
    .get('/', auth.authenticate(), (req, res) => {
  ...

  router
    .get('/register', (req, res) => {
 ....

This way you can apply authentication per endpoint.

commented

Many thanks for clarifying.