Fastify/5/Req Connection To Socket

/icons/calendar.svg

Last update

Dec 17, 2024

This codemod updates references from req.connection to req.socket, reflecting changes in Fastify v5's request handling.

Before

fastify.get('/route', (req, reply) => {
console.log(req.connection.remoteAddress);
return { hello: 'world' };
});

After

fastify.get('/route', (req, reply) => {
console.log(req.socket.remoteAddress);
return { hello: 'world' };
});

Build custom codemods

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

background illustrationGet Started Now