ApiExplorerPlugin
Defined in: src/plugins/application/api-explorer/plugin.ts:39
Shokupan Router
A router for organizing and grouping routes with shared middleware and configuration.
Template
Section titled “Template”The shape of ctx.state for all routes in this router.
Provides type safety for state management within the router’s middleware and handlers.
Examples
Section titled “Examples”const router = new ShokupanRouter();router.get('/users', (ctx) => ctx.json({ users: [] }));
app.mount('/api', router);// Routes: GET /api/usersinterface AuthState { userId: string; isAuthenticated: boolean;}
class AuthRouter extends ShokupanRouter<AuthState> { constructor() { super();
// Router middleware has typed state this.use((ctx, next) => { ctx.state.userId = 'user-123'; ctx.state.isAuthenticated = true; return next(); });
this.get('/me', (ctx) => { // State is fully typed return ctx.json({ userId: ctx.state.userId }); }); }}
app.mount('/auth', new AuthRouter());const apiRouter = new ShokupanRouter();
// Router-level middlewareapiRouter.use(async (ctx, next) => { console.log(`API request: ${ctx.method} ${ctx.path}`); return next();});
apiRouter.get('/status', (ctx) => ctx.json({ status: 'ok' }));app.mount('/api', apiRouter);Extends
Section titled “Extends”Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ApiExplorerPlugin(
pluginOptions):ApiExplorerPlugin
Defined in: src/plugins/application/api-explorer/plugin.ts:41
Parameters
Section titled “Parameters”pluginOptions
Section titled “pluginOptions”ApiExplorerOptions = {}
Returns
Section titled “Returns”ApiExplorerPlugin
Overrides
Section titled “Overrides”Properties
Section titled “Properties”[$childControllers]
Section titled “[$childControllers]”[$childControllers]:
ShokupanController[] =[]
Defined in: src/router.ts:101
Inherited from
Section titled “Inherited from”ShokupanRouter.[$childControllers]
[$childRouters]
Section titled “[$childRouters]”[$childRouters]:
ShokupanRouter<GlobalShokupanState>[] =[]
Defined in: src/router.ts:100
Inherited from
Section titled “Inherited from”ShokupanRouter.[$childRouters]
[$mountPath]
Section titled “[$mountPath]”[$mountPath]:
string="/"
Defined in: src/router.ts:97
Inherited from
Section titled “Inherited from”[$routes]
Section titled “[$routes]”[$routes]:
ShokupanRoute[] =[]
Defined in: src/router.ts:146
Inherited from
Section titled “Inherited from”config?
Section titled “config?”
readonlyoptionalconfig:object
Defined in: src/router.ts:297
autoBackpressureFeedback?
Section titled “autoBackpressureFeedback?”
optionalautoBackpressureFeedback:boolean
Whether to enable automatic backpressure based on system CPU load.
Default
Section titled “Default”falseautoBackpressureLevel?
Section titled “autoBackpressureLevel?”
optionalautoBackpressureLevel:number
The CPU usage percentage threshold (0-100) at which to start rejecting requests.
fileAccessCheck()?
Section titled “fileAccessCheck()?”
optionalfileAccessCheck: (ctx,path) =>boolean
Custom file access check for routes that use ctx.file(). Return true to allow access to the file, false to deny.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
group?
Section titled “group?”
optionalgroup:string
hooks?
Section titled “hooks?”
optionalhooks: {afterValidate?: (ctx,data) =>void|Promise<void>;beforeValidate?: (ctx,data) =>void|Promise<void>;onError?: (ctx,error) =>void|Promise<void>;onReadTimeout?: (ctx) =>void|Promise<void>;onRequestEnd?: (ctx) =>void|Promise<void>;onRequestStart?: (ctx) =>void|Promise<void>;onRequestTimeout?: (ctx) =>void|Promise<void>;onResponseEnd?: (ctx,response) =>void|Promise<void>;onResponseStart?: (ctx,response) =>void|Promise<void>;onStop?: () =>void|Promise<void>;onWriteTimeout?: (ctx) =>void|Promise<void>; } | ({afterValidate?: (ctx,data) =>void|Promise<void>;beforeValidate?: (ctx,data) =>void|Promise<void>;onError?: (ctx,error) =>void|Promise<void>;onReadTimeout?: (ctx) =>void|Promise<void>;onRequestEnd?: (ctx) =>void|Promise<void>;onRequestStart?: (ctx) =>void|Promise<void>;onRequestTimeout?: (ctx) =>void|Promise<void>;onResponseEnd?: (ctx,response) =>void|Promise<void>;onResponseStart?: (ctx,response) =>void|Promise<void>;onStop?: () =>void|Promise<void>;onWriteTimeout?: (ctx) =>void|Promise<void>; } |undefined)[]
Hooks for this route/router.
optionalname:string
openapi?
Section titled “openapi?”
optionalopenapi: {[key:`x-${string}`]:any; [key:string]:any;consumes?: (string|undefined)[];deprecated?:boolean;description?:string;externalDocs?: {[key:string]:any;description?:string;url?:string; };operationId?:string;parameters?: ({[key:`x-${string}`]:any; [key:string]:any;$ref?:string; } | {[key:string]:any;description?:string;in?:ParameterLocation;name?:string;required?:boolean;schema?: {[key:`x-${(...)}`]:any; [key:string]:any;$ref?: … | …; } | {[key:string]:any; [key:`x-${(...)}`]:any;$ref?: … | …;$schema?: … | …;additionalItems?: … | … | … | …;additionalProperties?: … | … | … | …;allOf?: … | …;anyOf?: … | …;default?:any;definitions?: … | …;dependencies?: … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;exclusiveMaximum?: … | … | …;exclusiveMinimum?: … | … | …;externalDocs?: … | …;id?: … | …;items?: … | … | … | … | …;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | … | …;uniqueItems?: … | … | …;xml?: … | …; }; } | {[key:string]:any;$ref?:string;allowEmptyValue?:boolean;collectionFormat?:string;default?:any;description?:string;enum?:any[];exclusiveMaximum?:boolean;exclusiveMinimum?:boolean;format?:string;in?:ParameterLocation;items?: {[key:`x-${(...)}`]:any; [key:string]:any;$ref?: … | …; } | {$ref?: … | …;collectionFormat?: … | …;default?:any;enum?: … | …;exclusiveMaximum?: … | … | …;exclusiveMinimum?: … | … | …;format?: … | …;items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | { type?: string | undefined; format?: string | undefined; items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | … | undefined; … 14 more …; $ref?: string | undefined; } | undefined;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;multipleOf?: … | …;pattern?: … | …;type?: … | …;uniqueItems?: … | … | …; };maximum?:number;maxItems?:number;maxLength?:number;minimum?:number;minItems?:number;minLength?:number;multipleOf?:number;name?:string;pattern?:string;required?:boolean;type?:string;uniqueItems?:boolean; } |undefined)[];produces?: (string|undefined)[];responses?: {[key:string]: {[key:`x-${string}`]:any; [key:string]:any;$ref?:string; } | {[key:`x-${string}`]:any; [key:string]:any;description?:string;examples?: {[key:string]:any; };headers?: {[key:string]: … | …; };schema?: {[key:`x-${(...)}`]:any; [key:string]:any;$ref?: … | …; } | {[key:string]:any; [key:`x-${(...)}`]:any;$ref?: … | …;$schema?: … | …;additionalItems?: … | … | … | …;additionalProperties?: … | … | … | …;allOf?: … | …;anyOf?: … | …;default?:any;definitions?: … | …;dependencies?: … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;exclusiveMaximum?: … | … | …;exclusiveMinimum?: … | … | …;externalDocs?: … | …;id?: … | …;items?: … | … | … | … | …;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | … | …;uniqueItems?: … | … | …;xml?: … | …; }; } |undefined;default?: {[key:`x-${string}`]:any; [key:string]:any;$ref?:string; } | {[key:`x-${string}`]:any; [key:string]:any;description?:string;examples?: {[key:string]:any; };headers?: {[key:string]: … | …; };schema?: {[key:`x-${(...)}`]:any; [key:string]:any;$ref?: … | …; } | {[key:string]:any; [key:`x-${(...)}`]:any;$ref?: … | …;$schema?: … | …;additionalItems?: … | … | … | …;additionalProperties?: … | … | … | …;allOf?: … | …;anyOf?: … | …;default?:any;definitions?: … | …;dependencies?: … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;exclusiveMaximum?: … | … | …;exclusiveMinimum?: … | … | …;externalDocs?: … | …;id?: … | …;items?: … | … | … | … | …;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | … | …;uniqueItems?: … | … | …;xml?: … | …; }; }; };schemes?: (string|undefined)[];security?: ({[key:string]: (… | …)[] |undefined; } |undefined)[];summary?:string;tags?: (string|undefined)[]; } | {[key:`x-${string}`]:any; [key:string]:any;callbacks?: {[key:string]: {[key:`x-${string}`]:any; [key:string]:any;$ref?:string; } | {[key:string]: {[key:`x-${(...)}`]:any; [key:string]:any;$ref?: … | …;delete?: … | …;description?: … | …;get?: … | …;head?: … | …;options?: … | …;parameters?: … | …;patch?: … | …;post?: … | …;put?: … | …;servers?: … | …;summary?: … | …;trace?: … | …; } |undefined; } |undefined; };deprecated?:boolean;description?:string;externalDocs?: {description?:string;url?:string; };operationId?:string;parameters?: ({[key:`x-${string}`]:any; [key:string]:any;$ref?:string; } | {allowEmptyValue?:boolean;allowReserved?:boolean;content?: {[key:string]: … | …; };deprecated?:boolean;description?:string;example?:any;examples?: {[key:string]: … | … | …; };explode?:boolean;in?:ParameterLocation;name?:string;required?:boolean;schema?: {[key:`x-${(...)}`]:any; [key:string]:any;$ref?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;additionalProperties?: … | … | … | … | … | …;allOf?: … | …;anyOf?: … | …;default?:any;deprecated?: … | … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;exclusiveMaximum?: … | … | …;exclusiveMinimum?: … | … | …;externalDocs?: … | …;format?: … | …;items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; type?: “array” | undefined; items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | … | { …; } | undefined; … 33 more …; deprecated?: boolean | undefined; } | {…;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; type?: “array” | undefined; items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | … | { …; } | undefined; … 33 more …; deprecated?: boolean | undefined; } | {…;nullable?: … | … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | …;uniqueItems?: … | … | …;writeOnly?: … | … | …;xml?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;additionalProperties?: … | … | … | … | … | …;allOf?: … | …;anyOf?: … | …;default?:any;deprecated?: … | … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;exclusiveMaximum?: … | … | …;exclusiveMinimum?: … | … | …;externalDocs?: … | …;format?: … | …;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; type?: “array” | undefined; items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | … | { …; } | undefined; … 33 more …; deprecated?: boolean | undefined; } | {…;nullable?: … | … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | …;uniqueItems?: … | … | …;writeOnly?: … | … | …;xml?: … | …; };style?:ParameterStyle; } |undefined)[];requestBody?: {[key:`x-${string}`]:any; [key:string]:any;$ref?:string; } | {content?: {[key:string]: {encoding?: … | …;example?:any;examples?: … | …;schema?: … | … | … | …; } |undefined; };description?:string;required?:boolean; };responses?: {[key:string]: {[key:`x-${string}`]:any; [key:string]:any;$ref?:string; } | {[key:`x-${string}`]:any; [key:string]:any;content?: {[key:string]: … | …; };description?:string;headers?: {[key:string]: … | … | …; };links?: {[key:string]: … | … | …; }; } |undefined; };security?: ({[key:string]: (… | …)[] |undefined; } |undefined)[];servers?: ({description?:string;url?:string;variables?: {[key:string]: … | …; }; } |undefined)[];summary?:string;tags?: (string|undefined)[]; } | {[key:string]:any; [key:number]:any;callbacks?: {[key:string]: {[key:string]:any; [key:number]:any;description?:string;summary?:string; } | {[key:string]: {[key:string]:any; [key:number]:any;description?: … | …;summary?: … | …; } | {[key:string]:any; [key:number]:any;delete?: … | …;get?: … | …;head?: … | …;options?: … | …;parameters?: … | …;patch?: … | …;post?: … | …;put?: … | …;servers?: … | …;trace?: … | …; } |undefined; } |undefined; };parameters?: ({allowEmptyValue?:boolean;allowReserved?:boolean;content?: {[key:string]: … | …; };deprecated?:boolean;description?:string;example?:any;examples?: {[key:string]: … | … | …; };explode?:boolean;in?:ParameterLocation;name?:string;required?:boolean;schema?: {[key:`x-${(...)}`]:any; [key:string]:any;$ref?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;additionalProperties?: … | … | … | … | … | …;allOf?: … | …;anyOf?: … | …;default?:any;deprecated?: … | … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;exclusiveMaximum?: … | … | …;exclusiveMinimum?: … | … | …;externalDocs?: … | …;format?: … | …;items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; type?: “array” | undefined; items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | … | { …; } | undefined; … 33 more …; deprecated?: boolean | undefined; } | {…;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; type?: “array” | undefined; items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | … | { …; } | undefined; … 33 more …; deprecated?: boolean | undefined; } | {…;nullable?: … | … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | …;uniqueItems?: … | … | …;writeOnly?: … | … | …;xml?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;additionalProperties?: … | … | … | … | … | …;allOf?: … | …;anyOf?: … | …;default?:any;deprecated?: … | … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;exclusiveMaximum?: … | … | …;exclusiveMinimum?: … | … | …;externalDocs?: … | …;format?: … | …;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; type?: “array” | undefined; items?: { [x: `x-${string}`]: any; [x: string]: any; $ref?: string | undefined; } | … | { …; } | undefined; … 33 more …; deprecated?: boolean | undefined; } | {…;nullable?: … | … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | …;uniqueItems?: … | … | …;writeOnly?: … | … | …;xml?: … | …; };style?:ParameterStyle; } | {[key:string]:any; [key:number]:any;description?:string;summary?:string; } |undefined)[];requestBody?: {[key:string]:any; [key:number]:any;description?:string;summary?:string; } | {content?: {[key:string]: {encoding?: … | …;example?:any;examples?: … | …;schema?: … | … | … | … | … | … | …; } |undefined; };description?:string;required?:boolean; };responses?: {[key:string]: {[key:string]:any; [key:number]:any;description?:string;summary?:string; } | {[key:string]:any; [key:number]:any;content?: {[key:string]: … | …; };headers?: {[key:string]: … | … | …; };links?: {[key:string]: … | … | …; }; } |undefined; };servers?: ({description?:string;url?:string;variables?: {[key:string]: … | …; }; } |undefined)[]; } | {[key:string]:any; [key:number]:any;callbacks?: {[key:string]: {[key:string]:any; [key:number]:any;description?:string;summary?:string; } | {[key:string]: {[key:string]:any; [key:number]:any;description?: … | …;summary?: … | …; } | {[key:string]:any; [key:number]:any;additionalOperations?: … | …;delete?: … | …;get?: … | …;head?: … | …;options?: … | …;parameters?: … | …;patch?: … | …;post?: … | …;put?: … | …;query?: … | …;trace?: … | …; } |undefined; } |undefined; };parameters?: ({[key:string]:any; [key:number]:any;description?:string;summary?:string; } | {allowEmptyValue?:boolean;allowReserved?:boolean;content?: {[key:string]: … | …; };deprecated?:boolean;description?:string;example?:any;examples?: {[key:string]: … | … | …; };explode?:boolean;in?:ParameterLocation;name?:string;required?:boolean;schema?: {[key:string]:any; [key:number]:any;description?: … | …;summary?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;valueOf?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;valueOf?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;$schema?: … | …;additionalProperties?: … | … | … | … | … | … | … | … | …;allOf?: … | …;anyOf?: … | …;const?:any;contentMediaType?: … | …;default?:any;deprecated?: … | … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;examples?: … | …;exclusiveMaximum?: … | …;exclusiveMinimum?: … | …;externalDocs?: … | …;format?: … | …;items?: { [x: string]: any; [x: number]: any; summary?: string | undefined; description?: string | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; valueOf?: (() => boolean) | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; valueOf?: (() => boolean) | undefined; } | { …; } | { …; } | { …; } | un…;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: … | … | … | … | … | … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | …;uniqueItems?: … | … | …;writeOnly?: … | … | …;xml?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;$schema?: … | …;additionalProperties?: … | … | … | … | … | … | … | … | …;allOf?: … | …;anyOf?: … | …;const?:any;contentMediaType?: … | …;default?:any;deprecated?: … | … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;examples?: … | …;exclusiveMaximum?: … | …;exclusiveMinimum?: … | …;externalDocs?: … | …;format?: … | …;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: … | … | … | … | … | … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | …;uniqueItems?: … | … | …;writeOnly?: … | … | …;xml?: … | …; } | {[key:`x-${(...)}`]:any; [key:string]:any;$schema?: … | …;additionalProperties?: … | … | … | … | … | … | … | … | …;allOf?: … | …;anyOf?: … | …;const?:any;contentMediaType?: … | …;default?:any;deprecated?: … | … | …;description?: … | …;discriminator?: … | …;enum?: … | …;example?:any;examples?: … | …;exclusiveMaximum?: … | …;exclusiveMinimum?: … | …;externalDocs?: … | …;format?: … | …;items?: { [x: string]: any; [x: number]: any; summary?: string | undefined; description?: string | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; valueOf?: (() => boolean) | undefined; } | { [x: `x-${string}`]: any; [x: string]: any; valueOf?: (() => boolean) | undefined; } | { …; } | { …; } | { …; } | un…;maximum?: … | …;maxItems?: … | …;maxLength?: … | …;maxProperties?: … | …;minimum?: … | …;minItems?: … | …;minLength?: … | …;minProperties?: … | …;multipleOf?: … | …;not?: … | … | … | … | … | … | …;oneOf?: … | …;pattern?: … | …;patternProperties?: … | …;properties?: … | …;readOnly?: … | … | …;required?: … | …;title?: … | …;type?: … | …;uniqueItems?: … | … | …;writeOnly?: … | … | …;xml?: … | …; };style?:ParameterStyle; } |undefined)[];requestBody?: {[key:string]:any; [key:number]:any;description?:string;summary?:string; } | {content?: {[key:string]: {[key:string]:any; [key:number]:any;description?: … | …;summary?: … | …; } | {encoding?: … | …;example?:any;examples?: … | …;itemEncoding?: … | …;itemSchema?: … | … | … | … | … | … | …;prefixEncoding?: … | …;schema?: … | … | … | … | … | … | …; } |undefined; };description?:string;required?:boolean; };responses?: {[key:string]: {[key:string]:any; [key:number]:any;description?:string;summary?:string; } | {[key:string]:any; [key:number]:any;content?: {[key:string]: … | … | …; };headers?: {[key:string]: … | … | …; };links?: {[key:string]: … | … | …; };summary?:string; } |undefined; };servers?: ({description?:string;name?:string;url?:string;variables?: {[key:string]: … | …; }; } |undefined)[]; }
renderer?
Section titled “renderer?”
optionalrenderer:JSXRenderer
Custom renderer for this route.
requestTimeout?
Section titled “requestTimeout?”
optionalrequestTimeout:number
Timeout for this specific route (milliseconds).
Inherited from
Section titled “Inherited from”mcpProtocol
Section titled “mcpProtocol”mcpProtocol:
McpProtocol
Defined in: src/router.ts:150
Inherited from
Section titled “Inherited from”metadata?
Section titled “metadata?”
optionalmetadata:RouteMetadata
Defined in: src/router.ts:148
Inherited from
Section titled “Inherited from”middleware
Section titled “middleware”middleware:
Middleware[] =[]
Defined in: src/router.ts:133
Inherited from
Section titled “Inherited from”requestTimeout?
Section titled “requestTimeout?”
optionalrequestTimeout:number
Defined in: src/router.ts:126
Inherited from
Section titled “Inherited from”Accessors
Section titled “Accessors”hasAfterValidateHook
Section titled “hasAfterValidateHook”Get Signature
Section titled “Get Signature”get hasAfterValidateHook():
boolean
Defined in: src/router.ts:124
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasAfterValidateHook
hasBeforeValidateHook
Section titled “hasBeforeValidateHook”Get Signature
Section titled “Get Signature”get hasBeforeValidateHook():
boolean
Defined in: src/router.ts:123
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasBeforeValidateHook
hasOnErrorHook
Section titled “hasOnErrorHook”Get Signature
Section titled “Get Signature”get hasOnErrorHook():
boolean
Defined in: src/router.ts:119
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”hasOnReadTimeoutHook
Section titled “hasOnReadTimeoutHook”Get Signature
Section titled “Get Signature”get hasOnReadTimeoutHook():
boolean
Defined in: src/router.ts:121
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasOnReadTimeoutHook
hasOnRequestEndHook
Section titled “hasOnRequestEndHook”Get Signature
Section titled “Get Signature”get hasOnRequestEndHook():
boolean
Defined in: src/router.ts:117
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasOnRequestEndHook
hasOnRequestStartHook
Section titled “hasOnRequestStartHook”Get Signature
Section titled “Get Signature”get hasOnRequestStartHook():
boolean
Defined in: src/router.ts:116
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasOnRequestStartHook
hasOnRequestTimeoutHook
Section titled “hasOnRequestTimeoutHook”Get Signature
Section titled “Get Signature”get hasOnRequestTimeoutHook():
boolean
Defined in: src/router.ts:120
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasOnRequestTimeoutHook
hasOnResponseEndHook
Section titled “hasOnResponseEndHook”Get Signature
Section titled “Get Signature”get hasOnResponseEndHook():
boolean
Defined in: src/router.ts:115
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasOnResponseEndHook
hasOnResponseStartHook
Section titled “hasOnResponseStartHook”Get Signature
Section titled “Get Signature”get hasOnResponseStartHook():
boolean
Defined in: src/router.ts:118
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasOnResponseStartHook
hasOnStopHook
Section titled “hasOnStopHook”Get Signature
Section titled “Get Signature”get hasOnStopHook():
boolean
Defined in: src/router.ts:114
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”hasOnWriteTimeoutHook
Section titled “hasOnWriteTimeoutHook”Get Signature
Section titled “Get Signature”get hasOnWriteTimeoutHook():
boolean
Defined in: src/router.ts:122
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”ShokupanRouter.hasOnWriteTimeoutHook
logger
Section titled “logger”Get Signature
Section titled “Get Signature”get logger():
Logger|undefined
Defined in: src/router.ts:142
Returns
Section titled “Returns”Logger | undefined
Inherited from
Section titled “Inherited from”registry
Section titled “registry”Get Signature
Section titled “Get Signature”get registry():
object
Defined in: src/router.ts:208
Returns
Section titled “Returns”object
controllers
Section titled “controllers”controllers:
object[]
events
Section titled “events”events:
object[]
metadata
Section titled “metadata”metadata:
RouteMetadata|undefined
middleware
Section titled “middleware”middleware:
object[]
routers
Section titled “routers”routers:
object[]
routes
Section titled “routes”routes:
object[]
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get root():
Shokupan<any>
Defined in: src/router.ts:138
Returns
Section titled “Returns”Shokupan<any>
Inherited from
Section titled “Inherited from”rootConfig
Section titled “rootConfig”Get Signature
Section titled “Get Signature”get rootConfig():
Partial<{adapter?:ServerAdapter|"bun"|"node"|"wintercg";aiPlugin?: {api?: {is_user_authenticated?:boolean;type:"openapi";url?:string; };auth?: {[key:string]:any;type:"none"|"service_http"|"user_http"|"oauth"; };contact_email?:string;description_for_human?:string;description_for_model?:string;enabled?:boolean;legal_info_url?:string;logo_url?:string;name_for_human?:string;name_for_model?:string; };allowChunkedBody?:boolean;allowedStaticFilePaths?:string[];apiCatalog?: {enabled?:boolean;versions?:object[]; };astAnalysisTimeout?:number;astFilePath?:string;autoBackpressureFeedback?:boolean;autoBackpressureLevel?:number;blockOnAsyncApiGen:boolean;blockOnOpenApiGen:boolean;datastore?: {adapter:"surreal"|"sqlite"|"level";options?:any; };defaultResponseTransformer?:string;defaultSecurityHeaders?:any;development:boolean;disableBodyParsing?:boolean;enableAbortController?:boolean;enableAsyncApiGen:boolean;enableAsyncAstScanning?:boolean;enableAsyncLocalStorage:boolean;enableAutoContentNegotiation?:boolean;enableHTTPBridge?:boolean;enableMiddlewareTracking:boolean;enableOpenApiGen:boolean;enablePromiseMonkeypatch:boolean;enableTracing?:boolean;enableWebSocketTracking?:boolean;fileAccessCheck?: (ctx,path) =>boolean;fileSystem?:FileSystemAdapter;hooks:ShokupanHooks<Record<string,any>> |ShokupanHooks<Record<string,any>>[];hostname:string;httpLogger: (ctx) =>void;ide?:string;idGenerator?: () =>string;jsonParser?:"native"|"parse-json"|"secure-json-parse";logger:Logger;maxBodySize?:number;middlewareTrackingMaxCapacity?:number;middlewareTrackingTTL?:number;port:number;queryParserMode?:"strict"|"extended"|"simple";readTimeout:number;renderer:JSXRenderer;requestTimeout:number;reusePort:boolean;tls: {[key:string]:any;cert:string;key:string; };validateStatusCodes:boolean;websocketErrorHandler?: (err,ctx) =>void|Promise<void>;writeTimeout:number; }>
Defined in: src/router.ts:135
Returns
Section titled “Returns”Partial<{ adapter?: ServerAdapter | "bun" | "node" | "wintercg"; aiPlugin?: { api?: { is_user_authenticated?: boolean; type: "openapi"; url?: string; }; auth?: {[key: string]: any; type: "none" | "service_http" | "user_http" | "oauth"; }; contact_email?: string; description_for_human?: string; description_for_model?: string; enabled?: boolean; legal_info_url?: string; logo_url?: string; name_for_human?: string; name_for_model?: string; }; allowChunkedBody?: boolean; allowedStaticFilePaths?: string[]; apiCatalog?: { enabled?: boolean; versions?: object[]; }; astAnalysisTimeout?: number; astFilePath?: string; autoBackpressureFeedback?: boolean; autoBackpressureLevel?: number; blockOnAsyncApiGen: boolean; blockOnOpenApiGen: boolean; datastore?: { adapter: "surreal" | "sqlite" | "level"; options?: any; }; defaultResponseTransformer?: string; defaultSecurityHeaders?: any; development: boolean; disableBodyParsing?: boolean; enableAbortController?: boolean; enableAsyncApiGen: boolean; enableAsyncAstScanning?: boolean; enableAsyncLocalStorage: boolean; enableAutoContentNegotiation?: boolean; enableHTTPBridge?: boolean; enableMiddlewareTracking: boolean; enableOpenApiGen: boolean; enablePromiseMonkeypatch: boolean; enableTracing?: boolean; enableWebSocketTracking?: boolean; fileAccessCheck?: (ctx, path) => boolean; fileSystem?: FileSystemAdapter; hooks: ShokupanHooks<Record<string, any>> | ShokupanHooks<Record<string, any>>[]; hostname: string; httpLogger: (ctx) => void; ide?: string; idGenerator?: () => string; jsonParser?: "native" | "parse-json" | "secure-json-parse"; logger: Logger; maxBodySize?: number; middlewareTrackingMaxCapacity?: number; middlewareTrackingTTL?: number; port: number; queryParserMode?: "strict" | "extended" | "simple"; readTimeout: number; renderer: JSXRenderer; requestTimeout: number; reusePort: boolean; tls: {[key: string]: any; cert: string; key: string; }; validateStatusCodes: boolean; websocketErrorHandler?: (err, ctx) => void | Promise<void>; writeTimeout: number; }>
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”add(
arg):ApiExplorerPlugin
Defined in: src/router.ts:1160
Adds a route to the router.
Parameters
Section titled “Parameters”Route configuration object
controller?
Section titled “controller?”any
Controller for the route
group?
Section titled “group?”string
Group for the route
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState>
Route handler function
metadata?
Section titled “metadata?”{ file: string; line: number; }
metadata.file
Section titled “metadata.file”string
metadata.line
Section titled “metadata.line”number
method
Section titled “method”HTTP method
middleware?
Section titled “middleware?”string
URL path
regex?
Section titled “regex?”RegExp
Custom regex for path matching
renderer?
Section titled “renderer?”JSX renderer for the route
requestTimeout?
Section titled “requestTimeout?”number
Timeout for this route in milliseconds
OpenAPI specification for the route
Returns
Section titled “Returns”ApiExplorerPlugin
Inherited from
Section titled “Inherited from”bindController()
Section titled “bindController()”bindController(
controller):void
Defined in: src/router.ts:402
Registers a controller instance to the router.
Parameters
Section titled “Parameters”controller
Section titled “controller”any
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”delete()
Section titled “delete()”Call Signature
Section titled “Call Signature”delete<
Path>(path,handler, …handlers):this
Defined in: src/router.ts:1368
Adds a DELETE route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”delete<
Path>(path,spec,handler, …handlers):this
Defined in: src/router.ts:1376
Adds a DELETE route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
OpenAPI specification for the route
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”find()
Section titled “find()”find(
method,path): {handler:ShokupanHandler<GlobalShokupanState>;params:Record<string,string>;route?:any; } |null
Defined in: src/router.ts:1065
Find a route matching the given method and path. Wraps handler with router middleware if present.
Parameters
Section titled “Parameters”method
Section titled “method”string
HTTP method
string
Request path
Returns
Section titled “Returns”{ handler: ShokupanHandler<GlobalShokupanState>; params: Record<string, string>; route?: any; } | null
Route handler and parameters if found, otherwise null
Inherited from
Section titled “Inherited from”findEvent()
Section titled “findEvent()”findEvent(
name):ShokupanHandler<GlobalShokupanState>[] |null
Defined in: src/router.ts:383
Finds an event handler(s) by name.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”ShokupanHandler<GlobalShokupanState>[] | null
Inherited from
Section titled “Inherited from”generateApiSpec()
Section titled “generateApiSpec()”generateApiSpec(
options):Promise<any>
Defined in: src/router.ts:1652
Generates an OpenAPI 3.1 Document by recursing through the router and its descendants. Now includes runtime analysis of handler functions to infer request/response types.
Parameters
Section titled “Parameters”options
Section titled “options”OpenAPIOptions = {}
Returns
Section titled “Returns”Promise<any>
Inherited from
Section titled “Inherited from”ShokupanRouter.generateApiSpec
Call Signature
Section titled “Call Signature”get<
Path>(path,handler, …handlers):this
Defined in: src/router.ts:1308
Adds a GET route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”get<
Path>(path,spec,handler, …handlers):this
Defined in: src/router.ts:1316
Adds a GET route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
OpenAPI specification for the route
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”getEventHandlers()
Section titled “getEventHandlers()”getEventHandlers():
Map<string,ShokupanHandler<GlobalShokupanState>[]>
Defined in: src/router.ts:409
Returns all registered event handlers.
Returns
Section titled “Returns”Map<string, ShokupanHandler<GlobalShokupanState>[]>
Inherited from
Section titled “Inherited from”ShokupanRouter.getEventHandlers
getRoutes()
Section titled “getRoutes()”getRoutes():
object[]
Defined in: src/router.ts:801
Returns all routes attached to this router and its descendants.
Returns
Section titled “Returns”object[]
Inherited from
Section titled “Inherited from”guard()
Section titled “guard()”Call Signature
Section titled “Call Signature”guard(
handler):void
Defined in: src/router.ts:1509
Adds a guard to the router that applies to all routes added after this point.
Guards must return true or call ctx.next() to allow the request to continue.
Parameters
Section titled “Parameters”handler
Section titled “handler”ShokupanHandler<GlobalShokupanState>
Guard handler function
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”guard(
spec,handler):void
Defined in: src/router.ts:1517
Adds a guard to the router that applies to all routes added after this point.
Guards must return true or call ctx.next() to allow the request to continue.
Parameters
Section titled “Parameters”OpenAPI specification for the guard
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState>
Guard handler function
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”hasHooks()
Section titled “hasHooks()”hasHooks(
name):boolean
Defined in: src/router.ts:1657
Parameters
Section titled “Parameters”keyof ShokupanHooks<any>
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”head()
Section titled “head()”Call Signature
Section titled “Call Signature”head<
Path>(path,handler, …handlers):this
Defined in: src/router.ts:1428
Adds a HEAD route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”head<
Path>(path,spec,handler, …handlers):this
Defined in: src/router.ts:1436
Adds a HEAD route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
OpenAPI specification for the route
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”hook()
Section titled “hook()”hook(
name,handler):ApiExplorerPlugin
Defined in: src/router.ts:317
Registers a lifecycle hook dynamically.
Parameters
Section titled “Parameters”keyof ShokupanHooks<any>
handler
Section titled “handler”Function
Returns
Section titled “Returns”ApiExplorerPlugin
Inherited from
Section titled “Inherited from”init()
Section titled “init()”init():
void
Defined in: src/plugins/application/api-explorer/plugin.ts:80
Returns
Section titled “Returns”void
internalRequest()
Section titled “internalRequest()”internalRequest(
arg):Promise<Response|undefined>
Defined in: src/router.ts:833
Makes an internal request through this router’s full routing pipeline. This is useful for calling other routes internally and supports streaming responses.
Parameters
Section titled “Parameters”string | { body?: any; headers?: HeadersInit; method?: Method; path: string; }
Returns
Section titled “Returns”Promise<Response | undefined>
The raw Response object.
Inherited from
Section titled “Inherited from”ShokupanRouter.internalRequest
mount()
Section titled “mount()”mount(
prefix,controller):ApiExplorerPlugin
Defined in: src/router.ts:423
Mounts a controller instance or WebSocket router to a path prefix.
Controller can be a convention router, WebSocket router, or an arbitrary class.
Routes are derived from method names:
- get(ctx) -> GET /prefix/
- getUsers(ctx) -> GET /prefix/users
- postCreate(ctx) -> POST /prefix/create
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
controller
Section titled “controller”Record<string, any> | ShokupanRouter<GlobalShokupanState> | ShokupanController | ShokupanController<GlobalShokupanState>
Returns
Section titled “Returns”ApiExplorerPlugin
Inherited from
Section titled “Inherited from”onInit()
Section titled “onInit()”onInit(
app,options?):void
Defined in: src/plugins/application/api-explorer/plugin.ts:56
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”options()
Section titled “options()”Call Signature
Section titled “Call Signature”options<
Path>(path,handler, …handlers):this
Defined in: src/router.ts:1408
Adds a OPTIONS route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”options<
Path>(path,spec,handler, …handlers):this
Defined in: src/router.ts:1416
Adds a OPTIONS route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
OpenAPI specification for the route
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”patch()
Section titled “patch()”Call Signature
Section titled “Call Signature”patch<
Path>(path,handler, …handlers):this
Defined in: src/router.ts:1388
Adds a PATCH route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”patch<
Path>(path,spec,handler, …handlers):this
Defined in: src/router.ts:1396
Adds a PATCH route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
OpenAPI specification for the route
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”post()
Section titled “post()”Call Signature
Section titled “Call Signature”post<
Path>(path,handler, …handlers):this
Defined in: src/router.ts:1328
Adds a POST route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”post<
Path>(path,spec,handler, …handlers):this
Defined in: src/router.ts:1336
Adds a POST route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
OpenAPI specification for the route
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”prompt()
Section titled “prompt()”prompt(
name,args,handler):ApiExplorerPlugin
Defined in: src/router.ts:359
Registers an MCP Prompt.
Parameters
Section titled “Parameters”string
object[] | undefined
handler
Section titled “handler”Function
Returns
Section titled “Returns”ApiExplorerPlugin
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”put<
Path>(path,handler, …handlers):this
Defined in: src/router.ts:1348
Adds a PUT route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”put<
Path>(path,spec,handler, …handlers):this
Defined in: src/router.ts:1356
Adds a PUT route to the router.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path
OpenAPI specification for the route
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
handlers
Section titled “handlers”…ShokupanHandler<GlobalShokupanState, RouteParams<Path>>[]
Route handler functions
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”resource()
Section titled “resource()”resource(
uri,options,handler):ApiExplorerPlugin
Defined in: src/router.ts:371
Registers an MCP Resource.
Parameters
Section titled “Parameters”string
options
Section titled “options”description?
Section titled “description?”string
mimeType?
Section titled “mimeType?”string
string
handler
Section titled “handler”Function
Returns
Section titled “Returns”ApiExplorerPlugin
Inherited from
Section titled “Inherited from”runHooks()
Section titled “runHooks()”runHooks(
name, …args):void|Promise<void[]>
Defined in: src/router.ts:1708
Parameters
Section titled “Parameters”keyof ShokupanHooks<any>
…any[]
Returns
Section titled “Returns”void | Promise<void[]>
Inherited from
Section titled “Inherited from”runOnStopHooks()
Section titled “runOnStopHooks()”runOnStopHooks(
app):Promise<void>
Defined in: src/router.ts:1749
Parameters
Section titled “Parameters”Shokupan<any>
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”socket()
Section titled “socket()”socket<
Path>(path,handler):this
Defined in: src/router.ts:1469
Adds a WebSocket route that handles its own upgrade logic.
Unless you need to handle the upgrade manually, you should use a ShokupanWebsocketRouter or WebsocketController instead.
Routes registered with .socket() will NOT be automatically upgraded by Shokupan’s WebSocket handling. You must implement
all event handlers manually. You have been warned.
Type Parameters
Section titled “Type Parameters”Path extends string
Parameters
Section titled “Parameters”Path
URL path for the WebSocket endpoint
handler
Section titled “handler”ShokupanHandler<GlobalShokupanState, RouteParams<Path>>
Route handler that will manually handle the upgrade
Returns
Section titled “Returns”this
Example
Section titled “Example”router.socket("/ws", (ctx) => { const success = ctx.upgrade({ data: { handler: { open: (ws) => console.log("Connected"), message: (ws, msg) => ws.send(msg), close: (ws) => console.log("Disconnected") } } }); if (!success) return ctx.text("Upgrade failed", 400);});Inherited from
Section titled “Inherited from”static()
Section titled “static()”static(
uriPath,options):ApiExplorerPlugin
Defined in: src/router.ts:1562
Statically serves a directory with standard options.
Parameters
Section titled “Parameters”uriPath
Section titled “uriPath”string
URL path prefix
options
Section titled “options”Configuration options or root directory string
string | StaticServeOptions<GlobalShokupanState>
Returns
Section titled “Returns”ApiExplorerPlugin
Inherited from
Section titled “Inherited from”testRequest()
Section titled “testRequest()”testRequest(
options):Promise<ProcessResult>
Defined in: src/router.ts:865
Processes a request for testing purposes. Returns a simplified { status, headers, data } object instead of a Response.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise<ProcessResult>
Inherited from
Section titled “Inherited from”tool()
Section titled “tool()”tool(
name,schema,handler):ApiExplorerPlugin
Defined in: src/router.ts:347
Registers an MCP Tool.
Parameters
Section titled “Parameters”string
schema
Section titled “schema”any
handler
Section titled “handler”Function
Returns
Section titled “Returns”ApiExplorerPlugin
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”use(
middleware):this
Defined in: src/router.ts:163
Registers middleware for this router. Middleware will run for all routes matched by this router.
Supports Express-style path-based middleware:
use('/admin', middleware) runs only for routes under /admin.
Parameters
Section titled “Parameters”middleware
Section titled “middleware”Middleware | ShokupanHandler<GlobalShokupanState>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”use(
path,middleware):this
Defined in: src/router.ts:164
Registers middleware for this router. Middleware will run for all routes matched by this router.
Supports Express-style path-based middleware:
use('/admin', middleware) runs only for routes under /admin.
Parameters
Section titled “Parameters”string
middleware
Section titled “middleware”Middleware | ShokupanHandler<GlobalShokupanState>
Returns
Section titled “Returns”this