pedronauck / micro-router

:station: A tiny and functional router for Zeit's Micro

Home Page:https://www.npmjs.com/microrouter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`withNamespace` should support Higer Order nesting.

ppot opened this issue · comments

let say:

const api = withNamespace('/v1')
const affiliate = withNamespace('/affiliate')

  api(
     affiliate(
         post('/affiliation', affiliation)
         get('/dashboard', dashboard)
     )
  )

instead of

const api = withNamespace('/v1')

  api(
     post('/affiliate/affiliation', affiliation)
     get('/affiliate/dashboard', dashboard)
  )

As of now with withNamespace it's closely the same as :

  router(
     post('/v1/affiliate/affiliation', affiliation)
     get('/v1/affiliate/dashboard', dashboard)
  )

The other way around would be the possibility of nesting router by their namespaces.

@pedronauck