///
///
///
///
///
import * as Http from "http";
import * as express from "express";
import * as winston from "winston";
import * as helmet from "helmet";
import { Request, Response, NextFunction, Express } from "express";
import * as Pug from "pug";
import { UserInterface } from "./User";
import { IMain, IDatabase, IOptions } from "pg-promise";
export interface i18NInterface {
[message: string]: {
[locale: string]: string;
};
}
export interface Options {
port?: number;
address?: string;
appLogLevel?: string;
maxLogSize?: number;
runtimeFolder?: string;
}
export declare abstract class HttpApplication {
static KEY_RUNTIME_FOLDER: string;
static KEY_ROOT_FOLDER: string;
static KEY_LOG_FOLDER: string;
static KEY_APPLICATION_NAME: string;
static KEY_AUTH_USER: string;
static KEY_AVAILABLE_LOCALES: string;
static KEY_LOCALE: string;
static KEY_I18N: string;
protected rootFolder: string;
protected varFolder: string;
protected logFolder: string;
protected appName: string;
protected options: Options;
protected expressApp: Express;
protected httpServer: Http.Server;
protected logger: winston.LoggerInstance;
protected httpErrorViews: any;
protected isTestMode: boolean;
protected database: IDatabase;
protected pgp: IMain;
private running;
protected abstract configureApplication(): any;
constructor(appName: string, rootFolder: string, options?: Options);
protected enterTestMode(): void;
protected setHttpErrorView(httpStatus: 404 | 500 | 503, viewFullPath: string): void;
protected createLogger(): void;
private normalizeOptions();
protected isDevel(): boolean;
protected getEnv(key: string, defValue: any): string;
protected configureHelmetSecurity(options?: helmet.IHelmetConfiguration): boolean;
private configureHttpLogger();
protected createHttpLogger(): string;
protected configurePostgreSQLDatabase(host: string, database: string, username: string, password: string, port?: number, options?: IOptions): void;
protected configureContentParsers(): boolean;
protected configureFilebasedSessionContainer(): boolean;
protected configureSessionContainer(): boolean;
getCurrentUser(req: Request): UserInterface;
setCurrentUser(req: Request, user: UserInterface): void;
getAvailableLocales(req: Request): Array;
getCurrentLocale(req: Request): string;
getContentType(req: Request): string;
protected configureAuthenticatedUser(): boolean;
getAcceptedLangugeHeader: (req: express.Request) => string;
protected configureFileBasedTranslationProvider(folders: Array): void;
translate(req: Request, message: string, ...args: any[]): string;
protected configureLocaleProvider(parameterName: string, defaultLocale?: string, availableLocales?: Array): boolean;
protected configureStaticFolderProvider(folders: any): boolean;
protected configureFaciconProvider(faviconPath: string): void;
protected configurePugTemplatesProvider(pugOptions?: Pug.Options): void;
protected configureApplicationInternal(): boolean;
private configure404StatusProvider();
protected handleFinalJSONError(err: any, req: Request, res: Response, next: NextFunction): void;
protected handleFinalHTMLError(err: any, req: Request, res: Response, next: NextFunction): void;
private configureFinalErrorProvider();
private createRuntimeFolders();
start(done?: Function): void;
stop(done?: Function): void;
protected onError(error: any): void;
protected onStart(): boolean;
protected onStop(): void;
}