/// import { Binding, Context, Constructor } from '@loopback/context'; import { Component } from '.'; import { ServerRequest, ServerResponse } from 'http'; import { HttpHandler } from './http-handler'; import { Sequence } from './sequence'; export declare class Application extends Context { options: ApplicationOptions; /** * Handle incoming HTTP(S) request by invoking the corresponding * Controller method via the configured Sequence. * * @example * * ```ts * const app = new Application(); * // setup controllers, etc. * * const server = http.createServer(app.handleHttp); * server.listen(3000); * ``` * * @param req The request. * @param res The response. */ handleHttp: (req: ServerRequest, res: ServerResponse) => Promise; protected _httpHandler: HttpHandler; constructor(options?: ApplicationOptions); protected _bindSequence(): void; protected _handleHttpRequest(request: ServerRequest, response: ServerResponse): Promise; protected _setupHandlerIfNeeded(): void; /** * Register a controller class with this application. * * @param controllerCtor {Function} The controller class * (constructor function). * @return {Binding} The newly created binding, you can use the reference to * further modify the binding, e.g. lock the value to prevent further * modifications. * * ```ts * @spec(apiSpec) * class MyController { * } * app.controller(MyController).lock(); * ``` */ controller(controllerCtor: Constructor): Binding; protected _logError(err: Error, statusCode: number, req: ServerRequest): void; } export interface ApplicationOptions { components?: Array>; sequence?: Constructor; }