@camar/http
Version:
To use __superconductor__ you need to build sources by `yarn build`
12 lines (11 loc) • 874 B
TypeScript
import { ContextResolver, IController as IController, IRequest, RequestMethod, IResponse, RouteHandler } from './types';
import Layer from './layer';
export default class Controller<TRequest extends IRequest<any, any>, TResponse extends IResponse, TContext, TLocalContext = TContext> implements IController<TRequest, TResponse, TContext, TLocalContext> {
private readonly template;
private readonly method;
layer: Layer<TRequest, TResponse, TContext>;
contextResolver: ContextResolver<TContext, TLocalContext>;
constructor(template: string, layer: Layer<TRequest, TResponse, any>, method: RequestMethod);
context<TNewContext>(resolver: ContextResolver<TLocalContext, TNewContext>): IController<TRequest, TResponse, TContext, TNewContext>;
handle(handler: RouteHandler<TRequest, TResponse, TLocalContext>): Layer<TRequest, TResponse, TContext>;
}