useRequest

Returns the core Fastify request object, only available in SSR.

import { useRequest } from 'fastify-vite-vue/server'
import { useRequest } from 'fastify-vite-react/server'
const req = useRequest()

For convenience, here's the API reference taken from the official Fastify documentation:

querythe parsed querystring
bodythe body
paramsthe params matching the URL
headersthe headers
rawthe incoming HTTP request from Node core
idthe request id
logthe logger instance of the incoming request
ipthe IP address of the incoming request
ips

An array of the IP addresses in the X-Forwarded-For header of the incoming request.

Only functional if the trustProxy server option is enabled.

hostnamethe hostname of the incoming request
protocolthe protocol of the incoming request (https or http)
methodthe method of the incoming request
urlthe url of the incoming request
routerMethodthe method defined for the router that is handling the request
routerPaththe path pattern defined for the router that is handling the request
is404true if request is being handled by 404 handler, false if it is not
socketthe underlying connection of the incoming request

This reference is also included in useHydration's return object as req.