@dazejs/framework
Version:
Daze.js - A powerful web framework for Node.js
99 lines (98 loc) • 3.27 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import cluster from 'cluster';
import { Server } from 'http';
import * as winston from 'winston';
import { Config } from '../config';
import { Container } from '../container';
import { HttpsOptions } from '../interfaces/external/https-options';
import { Database } from '../supports/database';
import { Logger } from '../supports/logger';
export interface ApplicationPathsOptions {
app?: string;
config?: string;
view?: string;
public?: string;
log?: string;
storeage?: string;
}
interface ApplicationCreateOption {
rootPath?: string;
paths?: ApplicationPathsOptions;
}
export declare class Application extends Container {
rootPath: string;
appPath: string;
configPath: string;
viewPath: string;
publicPath: string;
storeagePath: string;
logPath: string;
keys: any[];
private _server?;
private config;
port: number;
isDebug: boolean;
needsParseBody: boolean;
needsSession: boolean;
middlewares: {
middleware: any;
args: any[];
}[];
needsStaticServer: boolean;
launchCalls: ((...args: any[]) => any)[];
isHttps: boolean;
httpsOptions?: HttpsOptions;
private agent?;
private workers?;
constructor(option?: ApplicationCreateOption);
private initDirectoryStructure;
private initContainer;
private initConfig;
private initProvider;
private setupApp;
disableBodyParser(): void;
disableSession(): void;
disableStaticServer(): void;
getAgent(): cluster.Worker | undefined;
getWorkers(): cluster.Worker[] | undefined;
private registerVendorProviders;
register(Provider: any): Promise<void>;
fireLaunchCalls(...args: any[]): Promise<this>;
get isCluster(): any;
get isAgent(): boolean;
get isWorker(): boolean;
get isMaster(): boolean;
private getClusterMaterInstance;
private getClusterWorkerInstance;
private loadEnv;
private get env();
getEnv(): string | undefined;
private registerKeys;
private fireAgentResolves;
private registerCommonProviders;
private registerAutoProviders;
private registerAutoProviderDependencies;
private registerWorkerProvider;
use(Middleware: any, args?: any[]): this;
private loadGlobalMiddlewares;
initializeForCli(): Promise<void>;
initialize(): Promise<void>;
enableHttps(httpsOptions: HttpsOptions): this;
run(port?: number): Promise<Server | undefined>;
close(): Promise<void>;
private listen;
private handleEarsError;
call(abstract: any, args?: any[]): any;
tagged(tag: string): any;
tag(abstract: any, tag: string): this | undefined;
get(abstract: 'app', args?: any[], force?: boolean): Application;
get(abstract: 'config', args?: any[], force?: boolean): Config;
get(abstract: 'logger', args?: any[], force?: boolean): Logger & winston.Logger;
get(abstract: 'db', args?: any[], force?: boolean): Database;
get<T = any>(abstract: any, args?: any[], force?: boolean): T;
get(abstract: any, args?: any[], force?: boolean): any;
bind(abstract: any, concrete?: any, shared?: boolean, callable?: boolean): any;
has(abstract: any): boolean;
}
export {};