UNPKG

fastify-file-router

Version:

A fastify plugin that automatically registers routes from files in a directory.

25 lines 633 B
/** * Helper to define a route with type inference for request parameters, body, querystring, and headers. * * @example * ```typescript * export const route = defineRoute({ * schema: { * params: { * type: 'object', * properties: { id: { type: 'string' } }, * required: ['id'] * } as const * }, * handler: async (request, reply) => { * // request.params.id is correctly typed as string * const { id } = request.params; * reply.status(200).send({ id }); * } * }); * ``` */ export function defineRoute(route) { return route; } //# sourceMappingURL=defineRoute.js.map