HttpArc
class HttpArc<TLifecycle extends HostRuntimeLifecycle = "async"> extends HttpBaseTop-level application entry point.
Extends HttpBase with group for registering prefixed route groups and
run for handing control to the runtime selected by the build pipeline.
How you get one
Section titled “How you get one”Handed to you by the framework; see HTTP.
Methods
Section titled “Methods”after()
Section titled “after()”2 overloads
after(handler: HttpAfterHandler): voidhandler HttpAfterHandler
after<D extends InjectMap>(options: HttpMiddlewareOptions<D>, handler: (ctx: FlareHttpContext, result: HandlerResult, scope: HandlerScope<D>) => MiddlewareOverride | Promise<MiddlewareOverride>): voidoptions HttpMiddlewareOptions<D>
handler (ctx: FlareHttpContext, result: HandlerResult, scope: HandlerScope<D>) => MiddlewareOverride | Promise<MiddlewareOverride>
before()
Section titled “before()”2 overloads
before(handler: HttpBeforeHandler): voidhandler HttpBeforeHandler
before<D extends InjectMap>(options: HttpMiddlewareOptions<D>, handler: (ctx: FlareHttpContext, scope: HandlerScope<D>) => MiddlewareOverride | Promise<MiddlewareOverride>): voidoptions HttpMiddlewareOptions<D>
handler (ctx: FlareHttpContext, scope: HandlerScope<D>) => MiddlewareOverride | Promise<MiddlewareOverride>
delete()
Section titled “delete()”2 overloads
delete(path: string, handler: HttpRouteHandler): voidpath string
handler HttpRouteHandler
delete<O extends HttpRouteOptions>(path: string, options: O, handler: (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>): voidpath string
options O
handler (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>
error()
Section titled “error()”3 overloads
error(handler: ErrorHandlerClass): voidhandler ErrorHandlerClass
error(handler: HttpErrorHandler): voidhandler HttpErrorHandler
error<D extends InjectMap>(options: HttpErrorHandlerOptions<D>, handler: (err: FlareError<undefined> | Error, context: HttpErrorContext, scope: HandlerScope<D>) => void | ResponseLike | Promise<void | ResponseLike>): voidoptions HttpErrorHandlerOptions<D>
handler (err: FlareError<undefined> | Error, context: HttpErrorContext, scope: HandlerScope<D>) => void | ResponseLike | Promise<void | ResponseLike>
finally()
Section titled “finally()”2 overloads
finally(handler: HttpFinallyHandler): voidhandler HttpFinallyHandler
finally<D extends InjectMap>(options: HttpMiddlewareOptions<D>, handler: (ctx: FlareHttpContext, result: HandlerResult, scope: HandlerScope<D>) => MiddlewareOverride | Promise<MiddlewareOverride>): voidoptions HttpMiddlewareOptions<D>
handler (ctx: FlareHttpContext, result: HandlerResult, scope: HandlerScope<D>) => MiddlewareOverride | Promise<MiddlewareOverride>
2 overloads
get(path: string, handler: HttpRouteHandler): voidpath string
handler HttpRouteHandler
get<O extends HttpRouteOptions>(path: string, options: O, handler: (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>): voidpath string
options O
handler (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>
group()
Section titled “group()”group(prefix: string, builder: HttpGroupFn): voidRegisters a route group under a shared path prefix.
The builder receives a HttpGroup instance, a full HttpBase that
can have its own middleware, controllers, and nested groups. Registrations
made inside the builder are scoped to prefix.
prefix string · The path prefix applied to every route registered inside the group (e.g. "/api/v1").
builder HttpGroupFn · A function that configures the group and returns a GroupRegistration.
head()
Section titled “head()”2 overloads
head(path: string, handler: HttpRouteHandler): voidpath string
handler HttpRouteHandler
head<O extends HttpRouteOptions>(path: string, options: O, handler: (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>): voidpath string
options O
handler (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>
onStart()
Section titled “onStart()”onStart(fn: LifecycleCallback<TLifecycle>): voidRegisters a callback to be invoked when the application starts.
Callbacks are called in registration order during app startup.
fn LifecycleCallback<TLifecycle>
onStop()
Section titled “onStop()”onStop(fn: LifecycleCallback<TLifecycle>): voidRegisters a callback to be invoked when the application stops.
Callbacks are called in registration order during graceful shutdown.
fn LifecycleCallback<TLifecycle>
options()
Section titled “options()”2 overloads
options(path: string, handler: HttpRouteHandler): voidpath string
handler HttpRouteHandler
options<O extends HttpRouteOptions>(path: string, options: O, handler: (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>): voidpath string
options O
handler (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>
patch()
Section titled “patch()”2 overloads
patch(path: string, handler: HttpRouteHandler): voidpath string
handler HttpRouteHandler
patch<O extends HttpRouteOptions>(path: string, options: O, handler: (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>): voidpath string
options O
handler (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>
post()
Section titled “post()”2 overloads
post(path: string, handler: HttpRouteHandler): voidpath string
handler HttpRouteHandler
post<O extends HttpRouteOptions>(path: string, options: O, handler: (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>): voidpath string
options O
handler (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>
2 overloads
put(path: string, handler: HttpRouteHandler): voidpath string
handler HttpRouteHandler
put<O extends HttpRouteOptions>(path: string, options: O, handler: (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>): voidpath string
options O
handler (ctx: FlareHttpContext, scope: HttpHandlerScope<InjectOf<O>, DescriptorOf<O>>) => HandlerResult | Promise<HandlerResult>
Learn: HTTP