In express, I can do something like this:
router.route("/").get(getController).post(postController)
How can fastify also do that?
In express, I can do something like this:
router.route("/").get(getController).post(postController)
How can fastify also do that?
The fastify does not have this chaining option, you can use multiple methods with one handler: fastify.route()
fastify.route({
url: '/',
method: ['GET', 'POST'],
handler: singleController
})
// or
fastify.get('/', getController).post('/', postController)