Skip to main content

Class: RouteController

The Route Controller, The base class for Route which is used in routing files.

RouteController

Constructors

new RouteController()

new RouteController(application, container, logger, utilities): RouteController

Parameters

application: Express

container: Record<string, any> & Locals

logger: Logger

utilities: UtilitiesType

Returns

RouteController

Defined in

registry/types/Routes/BaseRouteType.ts:35

Methods

registerApplicationRoutes()

registerApplicationRoutes(_registry): ApplicationRoute

The register function for this route, configure your route in this.

There are NO DEFAULTS for this function, if nothing is set, the register function when the Jova server is started will fail.

Parameters

_registry: ApplicationRegistry

Returns

ApplicationRoute

Defined in

registry/types/Routes/BaseRouteType.ts:80


run()

run(_request, response): void | Response<any, Record<string, any>> | Promise<void | Response<any, Record<string, any>>>

The run function for this route, this function cannot be redefined to use another name, but only the content within the function.

Placeholder run function if nothing is defined:

Parameters

_request: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

response: Response<any, Record<string, any>>

Returns

void | Response<any, Record<string, any>> | Promise<void | Response<any, Record<string, any>>>

Example

return response
.status(HttpStatus.NotImplemented)
.json({ message: 'Route handler not implemented, server is unable to handle request.' });

@public

Defined in

registry/types/Routes/BaseRouteType.ts:63