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

Multiple routers

shailsharma opened this issue · comments

How to configure & use multiple routers?

const router1 = router(
  get('/hello/:who', hello)
);
const router2 = router(
  get('/hello1/:testing', testingFn)
)

So, I trying to figure out what you can do. Why do you have two same routes with different handlers?

I think that each microservice can have just one router, if you want to have two routers for an one microservice, you need to split it.

ohh sorry. updated the snippet.

You can do like shows here

const service = route(
  get('/hello/:who', hello),
  get('/hello1/:testing', testingFn)
)