tsoa-next / tsoa-next / KoaTemplateService
Class: KoaTemplateService
Defined in: packages/runtime/src/routeGeneration/templates/koa/koaTemplateService.ts:39
Koa-specific implementation of the generated route template service contract.
Extends
TemplateService<KoaApiHandlerParameters,KoaValidationArgsParameters,KoaReturnHandlerParameters>
Constructors
Constructor
new KoaTemplateService(models, config): KoaTemplateService;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:12
Parameters
models
config
Returns
KoaTemplateService
Inherited from
Properties
config
protected readonly config: AdditionalProps;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:14
Inherited from
models
protected readonly models: Models;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:13
Inherited from
validationService
protected validationService: ValidationService;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:10
Inherited from
TemplateService.validationService
Methods
apiHandler()
apiHandler(params): Promise<void | Context>;Defined in: packages/runtime/src/routeGeneration/templates/koa/koaTemplateService.ts:40
Invokes the controller action for the active runtime.
Parameters
params
KoaApiHandlerParameters
Returns
Promise<void | Context>
Overrides
buildPromise()
protected buildPromise(
methodName,
controller,
validatedArgs): Promise<unknown>;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:77
Parameters
methodName
string
controller
object | Controller
validatedArgs
unknown[]
Returns
Promise<unknown>
Inherited from
getBodyProperty()
protected getBodyProperty(
body,
headers,
propertyName): unknown;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:62
Parameters
body
unknown
headers
Record<string, unknown>
propertyName
string
Returns
unknown
Inherited from
TemplateService.getBodyProperty
getValidatedArgs()
getValidatedArgs(params): unknown[];Defined in: packages/runtime/src/routeGeneration/templates/koa/koaTemplateService.ts:64
Validates and normalizes the route arguments extracted from the request.
Parameters
params
KoaValidationArgsParameters
Returns
unknown[]
Overrides
TemplateService.getValidatedArgs
isController()
protected isController(object): object is Controller;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:28
Parameters
object
object | Controller
Returns
object is Controller
Inherited from
isRecord()
protected isRecord(value): value is Record<string, unknown>;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:73
Parameters
value
unknown
Returns
value is Record<string, unknown>
Inherited from
normalizeRequestBody()
protected normalizeRequestBody(body, headers): unknown;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:54
Parameters
body
unknown
headers
Record<string, unknown>
Returns
unknown
Inherited from
TemplateService.normalizeRequestBody
requestHasBody()
protected requestHasBody(headers): boolean;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:32
Parameters
headers
Record<string, unknown>
Returns
boolean
Inherited from
TemplateService.requestHasBody
requestUsesTransferEncoding()
protected requestUsesTransferEncoding(headers): boolean;Defined in: packages/runtime/src/routeGeneration/templates/templateService.ts:50
Parameters
headers
Record<string, unknown>
Returns
boolean
Inherited from
TemplateService.requestUsesTransferEncoding
returnHandler()
protected returnHandler(params): Promise<void> | Context | undefined;Defined in: packages/runtime/src/routeGeneration/templates/koa/koaTemplateService.ts:134
Writes the controller result back to the active runtime.
Parameters
params
KoaReturnHandlerParameters
Returns
Promise<void> | Context | undefined
