ukayani / restify-router

A router interface for restify that lets you aggregate route definitions and apply to a restify server
MIT License
52 stars 15 forks source link

Use joi with restify-router #14

Closed tsghosh closed 7 years ago

tsghosh commented 7 years ago

I am trying to add a validation using joi like this

sme.get('/country/:country/state/:state/city/:city',validator, function(req, res, next) { })

Can you please comment if it is possible to use joi adaptor like restify-joi-middleware with restify-router

thanks tuhin

ukayani commented 7 years ago

Hi @tsghosh ,

Yes, it is possible. You can use the exact same interface as the restify server.


const sme = new Router();
sme.get('/country/:country/state/:state/city/:city', validator, function(req, res, next) {
});

sme.applyRoutes(server);
tsghosh commented 7 years ago

Thanks.