UNPKG

@koex/bootstrap

Version:
64 lines (63 loc) 1.83 kB
/// <reference types="node" /> import { Server } from 'http'; import * as typings from '@koex/core'; import App from '@koex/core'; export declare const getNetworkAddress: () => string; declare module '@koex/core' { interface Config { } interface Helpers { } interface Middlewares { } interface Models { } interface Services { } interface Controllers { } interface Routes { } interface Application { readonly bootInfo: BootInfo; readonly config: Config; readonly middlewares: Middlewares; readonly services: Services; readonly controllers: Controllers; readonly routes: Routes; } interface Context { readonly config: Config; readonly helpers: Helpers; } } export declare type Loader<R> = (app: App) => Promise<R | void>; export interface BootInfo { system: any; bootStartedAt: Date; bootTime: number; runningStartedAt: Date; uptime: number; } export declare class Bootstrap { readonly app: typings.Application; private composeLoaders; constructor(app?: typings.Application); private registerLoader; private runLoader; private extendsApplication; private extendContext; private extends; loadConfig(fn: Loader<typings.Config>): this; loadHelpers(fn: Loader<typings.Helpers>): this; loadMiddlewares(fn: Loader<typings.Middlewares>): this; loadModels(fn: Loader<typings.Models>): this; loadServices(fn: Loader<typings.Services>): this; loadControllers(fn: Loader<typings.Controllers>): this; loadRoutes(fn: Loader<typings.Routes>): this; prepare(): Promise<Bootstrap>; private showBootMessage; startServer(): Promise<Server>; } export declare function bootstrap(app?: App): Bootstrap; export default bootstrap;