UNPKG

turtle-express

Version:

`turtle-express` is kinda a framework or a library based on `express.js` with an opinionated express router with type safety and schema validation with zod. Also many [more features](https://github.com/mm-ninja-turtles/turtle-express/discussions/7) planni

27 lines 1.18 kB
import { RequestHandler } from 'express'; import { OpenAPIV3_1 } from 'openapi-types'; import { ZodType } from 'zod'; import { HandlerOptions, HandlerResponse } from '../handler/create-handler'; import { Method, Path, ResolverTypes } from '../types/types'; export interface PathOptions { middlewares?: RequestHandler[]; openApi?: { tags?: OpenAPIV3_1.TagObject[]; }; } export interface PathHandler { _id: string; _method: Method; _middlewares: RequestHandler[]; _getOpenApiSchemas: () => OpenAPIV3_1.SchemaObject; _getOpenApiPathItem: () => OpenAPIV3_1.PathItemObject; } export interface PathReturnType { _path: Path; _handlers: PathHandler[]; _openApi: PathOptions['openApi']; path: typeof createPath; handler: <Params extends ZodType, Query extends ZodType, Body extends ZodType, ResolverType extends ResolverTypes = 'controlled', ResponseSchema extends HandlerResponse = HandlerResponse>(_handlerOptions: HandlerOptions<Params, Query, Body, ResolverType, ResponseSchema>) => void; } export declare function createPath(_path: Path, _options?: PathOptions): PathReturnType; //# sourceMappingURL=create-path.d.ts.map