Skip to main content
Module

x/oak_nest/mod.ts>Application

Refer to nestjs to realize some common functions for Deno, support hono and oak
Latest
class Application
import { Application } from "https://deno.land/x/oak_nest@v3.0.1/mod.ts";

Constructors

new
Application(router: IRouter)

Properties

private
abortController: AbortController
private
apiPrefix: string
private
apiPrefixOptions: ApiPrefixOptions
private
cache: Map<any, any>
private
controllers: Type<any>[]
private
globalExceptionFilters: ExceptionFilters
private
globalGuards: NestGuards
private
globalInterceptors: NestUseInterceptors
private
instances: Set<any>
private
logger: LoggerService
private
startTime
private
staticOptions: StaticOptions

Methods

private
beforeApplicationShutdown(signal?: string): Promise<void>
private
catchError(context: Context, error: any)
private
catchFilter(
target: InstanceType<Constructor>,
context: Context,
error: any,
)
private
formatResponse(context: Context, options: { target: InstanceType<Constructor>; args: any[]; methodName: string; methodType: string; fn: ControllerMethod; })
private
initController(Cls: Type)
private
initModule(module: ModuleType)
private
initProviders(providers: Provider[])
private
log(...message: string[])
private
onApplicationBootstrap(): Promise<void>

TODO: think about whether to use Promise.all or a for loop

private
onApplicationShutdown(signal?: string): Promise<void>

TODO: think about whether to use Promise.all or a for loop

private
onModuleDestroy(): Promise<void>
private
validateGuard(
target: InstanceType<Constructor>,
context: Context,
): Promise<boolean>
protected
routes()
addController(...clsArr: Type[])

add controller

Close the application.

Enables the usage of shutdown hooks. Will call the onApplicationShutdown function of a provider if the process receives a shutdown signal.

get(path: string, middleware: NestMiddleware)
init(appModule: ModuleType, cache: Map<any, any>)
listen(options?: ListenOptions): Promise<void>
setGlobalPrefix(apiPrefix: string, options?: ApiPrefixOptions)
use(...middlewares: NestMiddleware[]): void
useLogger(logger: LoggerService): void

Sets custom logger service. Flushes buffered logs if auto flush is on.

useStaticAssets(path: string, options?: StaticOptions)

Sets a base directory for public assets.