1 | import {IncomingMessage, ServerResponse, RequestListener} from "http";
|
2 | import {HttpContext} from "./context";
|
3 | import {HttpConfiguration} from "./config";
|
4 | import {AuthStrategy, EncryptionStrategy} from "./handlers/auth";
|
5 | import {LocalizationStrategy} from "./localization";
|
6 | import {SequentialEventEmitter} from "@themost/common/emitter";
|
7 |
|
8 | declare interface ApplicationOptions {
|
9 | port?: number|string;
|
10 | bind?: string;
|
11 | cluster?: number|string;
|
12 | }
|
13 |
|
14 | export declare interface HttpControllerConfiguration {
|
15 | configure(app:HttpApplication);
|
16 | }
|
17 |
|
18 | export declare class HttpContextProvider {
|
19 | constructor (app:HttpApplication);
|
20 | create(req:IncomingMessage, res: ServerResponse):HttpContext;
|
21 | }
|
22 |
|
23 | export declare class HttpApplication extends SequentialEventEmitter {
|
24 | constructor (executionPath:string);
|
25 |
|
26 | static getCurrent():HttpApplication;
|
27 |
|
28 | getConfiguration():HttpConfiguration;
|
29 | getEncryptionStrategy(): EncryptionStrategy;
|
30 | getAuthStrategy(): AuthStrategy;
|
31 | getLocalizationStrategy(): LocalizationStrategy;
|
32 | getExecutionPath(): string;
|
33 | mapExecutionPath(arg: string): string;
|
34 | useStaticContent(rootDir: string): HttpApplication;
|
35 | getConfigurationPath(): string;
|
36 | init(): HttpApplication;
|
37 | mapPath(arg: string): string;
|
38 | resolveUrl(appRelativeUrl: string): string;
|
39 | resolveETag(file: string, callback: (err?: Error, res?: string) => void);
|
40 | resolveMime(request: IncomingMessage): string;
|
41 | processRequest(context: HttpContext, callback: (err?: Error) => void);
|
42 | db(): any;
|
43 | getContextProvider(): HttpContextProvider;
|
44 | createContext(request: IncomingMessage, response: ServerResponse): HttpContext;
|
45 | executeExternalRequest(options: any,data: any, callback: (err?: Error, res?: any) => void);
|
46 | execute (fn: (context: HttpContext) => void);
|
47 | unattended (fn: (context: HttpContext) => void);
|
48 | executeRequest(options: any, callback: (err?: Error, res?: any) => void);
|
49 | start(options?: ApplicationOptions);
|
50 | runtime(): RequestListener;
|
51 | useController(name: string, controllerCtor: Function);
|
52 | useStrategy(serviceCtor: Function, strategyCtor: Function);
|
53 | useService(serviceCtor: Function);
|
54 | hasStrategy(serviceCtor: Function);
|
55 | hasService(serviceCtor: Function);
|
56 | getStrategy(serviceCtor: Function);
|
57 | getService(serviceCtor: Function);
|
58 | }
|