Skip to content

App Options

The App init constructor, as well as the Router init constructor, accept various options to configure OpenAPI schema generation, and top-level behavioral settings.

Class App

Main application class. Extends Router.

NameTypeDescriptionDefault
rootPath?stringRoot path of your application, a prefix that is not seen on the application but is seen by clients, like Worker Route Patterns and Swagger."/"
title?stringTitle of the application (OpenAPI)."Cerces API"
description?stringDescription of the application (OpenAPI).""
version?stringVersion of the application (OpenAPI)."0.1.0"
tagsInfo?TagObject[]List of tag descriptions used by application routes.[]
servers?ServerObject[]List of connectivity information of the application (OpenAPI).[{ url: this.rootPath }]
contact?ContactObjectContact info of the application (OpenAPI).undefined
license?LicenseObjectLicense info of the application (OpenAPI).undefined
termsOfService?stringTerms of service info of the application (OpenAPI).undefined
securitySchemes?Record<string, SecuritySchemeObject>Mapping of security schemes and authentication (OpenAPI).undefined
security?SecurityRequirementObject[]Array of security authentication requirements applied to all routes.[{ [key]: [] }] per keyof securitySchemes
tags?string[]List of tags to be applied to all routes.[]
deprecated?booleanSet the deprecated status to all routes.false
includeInSchema?booleanSet to include or exclude all routes from the generated OpenAPI document.true
responses?Record<number, ResponseConfig>Additional response schemas to all routes, shown in the generated OpenAPI document.{ 422: ... }
openapiUrl?null | stringRoute path URL for serving the OpenAPI JSON document."/openapi.json"
swaggerUrl?null | stringRoute path URL for serving the Swagger interactive documentation."/docs"
redocUrl?null | stringRoute path URL for serving the ReDoc alternative documentation."/redoc"
defaultResponseClass?ResponseClassDefault response class of all routes.JSONResponse
errorHandler?ErrorHandlerException handler when an exception or error has occurred during requests.baseExceptionHandler
middleware?Middleware[]List of middleware applied to this app.[]
parameters?GenericRouteParametersApp-level parameters applied to all routes.{}

Class Router

This class is used for structuring big applications into multiple routers that are later included in the main app.

NameTypeDescriptionDefault
basePs0Parent types extracted by Base<typeof parent>().-
tags?string[]List of tags to be applied to all routes.[]
deprecated?booleanSet the deprecated status to all routes.false
includeInSchema?booleanSet to include or exclude all routes from the generated OpenAPI document.true
security?SecurityRequirementObject[]Array of security authentication requirements applied to all routesundefined
responses?Record<number, ResponseConfig>Additional response schemas to all routes, shown in the generated OpenAPI document.{ 422: ... }
defaultResponseClass?ResponseClassDefault response class of all routes.JSONResponse
middleware?Middleware[]List of middleware applied to this router, merged when included in higher level routers.[]
parameters?Ps1Router-level parameters applied to all routes.{}