UNPKG

1.77 kBTypeScriptView Raw
1/// <reference types="express" />
2import { Context } from '@loopback/core';
3import { ComponentsObject, ControllerSpec, PathObject, ReferenceObject, SchemaObject, SchemasObject } from '@loopback/openapi-v3';
4import { RestServerResolvedConfig } from './rest.server';
5import { ControllerClass, ControllerFactory, ResolvedRoute, RouteEntry, RoutingTable } from './router';
6import { Request, Response } from './types';
7export declare class HttpHandler {
8 protected readonly _rootContext: Context;
9 protected readonly _serverConfig: RestServerResolvedConfig;
10 protected readonly _routes: RoutingTable;
11 /**
12 * Shared OpenAPI spec objects as `components`
13 */
14 protected _openApiComponents: ComponentsObject;
15 handleRequest: (request: Request, response: Response) => Promise<void>;
16 constructor(_rootContext: Context, _serverConfig: RestServerResolvedConfig, _routes?: RoutingTable);
17 registerController<T extends object>(spec: ControllerSpec, controllerCtor: ControllerClass<T>, controllerFactory?: ControllerFactory<T>): void;
18 registerRoute(route: RouteEntry): void;
19 /**
20 * @deprecated Use `registerApiComponents`
21 * @param defs Schemas
22 */
23 registerApiDefinitions(defs: SchemasObject): void;
24 /**
25 * Merge components into the OpenApi spec
26 * @param defs - Components
27 */
28 registerApiComponents(defs: ComponentsObject): void;
29 getApiComponents(): ComponentsObject;
30 /**
31 * @deprecated Use `getApiComponents`
32 */
33 getApiDefinitions(): {
34 [schema: string]: SchemaObject | ReferenceObject;
35 } | undefined;
36 describeApiPaths(): PathObject;
37 findRoute(request: Request): ResolvedRoute;
38 protected _handleRequest(request: Request, response: Response): Promise<void>;
39}