request.method
The HTTP method of the incoming request.
Syntax
request.method Returns
string — The uppercase HTTP method, e.g. GET or POST.
Examples
import Fastify from 'fastify';
const app = Fastify();
app.addHook('onRequest', async (req) => {
req.log.info(`${req.method} ${req.url}`);
});
Notes
Commonly read in hooks for logging or method-based logic. The value is
always uppercase.