tunnckoCore / koa-better-router

:heart: Stable and lovely router for `koa`, using `path-match`. Foundation for building powerful, flexible and RESTful APIs easily.
MIT License
89 stars 9 forks source link

Is there a way to add mutiple verb to single path? #64

Closed codinggirl closed 4 years ago

codinggirl commented 4 years ago

I need both GET and POST verb route to same path. Is there a method instead write two routes?

tunnckoCore commented 4 years ago

Hey, @codinggirl sorry for the late reply! It seems I missed that because of the noise of the notifications.

I don't think so. But you simply do it with something like

function yourPostAndGetHandler() {}

router.get('/', yourPostAndGetHandler);
router.post('/', yourPostAndGetHandler);
codinggirl commented 4 years ago

Thank you.