import type { NextFunction, Request, Response } from 'express'; import { type Options, type Schema } from 'fast-json-stringify'; export type { Schema, Options } from 'fast-json-stringify'; export type FastJsonSchemaOptions = Omit; /** * Build a middleware that gives its route a serializer compiled from the schema. * The application needs `installFastJson(app)` once for `res.fastJson()` to exist. * * @param {Schema} schema The schema used to stringify values * @param {FastJsonSchemaOptions} options The fast-json-stringify options (optional) * @see https://www.npmjs.com/package/fast-json-stringify * * Examples: * ```ts * import express from 'express'; * import { installFastJson, fastJsonSchema, Schema } from 'express-fast-json-stringify'; * * const app = express(); * installFastJson(app); * * const schema: Schema = { * title: 'Example Schema', * type: 'object', * properties: { * firstName: { * type: 'string', * }, * lastName: { * type: 'string', * }, * age: { * type: 'integer', * } * }, * }; * * app.get('/', fastJsonSchema(schema), (req, res, next) => { * try { * const data = { * firstName: "Simone", * lastName: "Nigro", * age: 40 * }; * res.fastJson(data); * } catch (error) { * next(error); * } * }); * ``` */ export declare const fastJsonSchema: (schema: Schema, options?: FastJsonSchemaOptions) => (_req: Request, res: Response, next: NextFunction) => void;