Fastify/5/Add Expose Head Routes Option

/icons/calendar.svg

Last update

Sep 17, 2024

This codemod introduces the exposeHeadRoutes: false option to avoid automatic HEAD route exposure, while keeping manually defined HEAD routes intact.

Before

fastify.get('/route', {}, (req, reply) => {
reply.send({ hello: 'world' });
});
fastify.head('/route', (req, reply) => {
// ...
});

After

fastify.get(
'/route', {
exposeHeadRoutes: false,
},
(req, reply) => {
reply.send({ hello: 'world' });
},
);
fastify.head('/route', (req, reply) => {
// ...
});

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now