request.query
The parsed query-string parameters of the request.
Syntax
request.query Returns
object — A key/value map of query parameters.
Examples
import Fastify from 'fastify';
const app = Fastify();
app.get<{ Querystring: { page?: number } }>(
'/cats',
{
schema: {
querystring: {
type: 'object',
properties: { page: { type: 'integer', default: 1 } },
},
},
},
async (req) => ({ page: req.query.page }),
);
Notes
Query values are strings unless a `querystring` schema coerces them. Use
schema defaults to supply fallback values for optional parameters.