UNPKG

@tiscode/node-base

Version:

TISCODE Base Module for NodeJS Applications

73 lines 2.56 kB
/// <reference types="node" /> import { Application as IExpressApp } from 'express'; import ExpressStatic from 'express'; import * as ExpressCore from "express-serve-static-core"; import { OptionsJson, OptionsText, OptionsUrlencoded } from 'body-parser'; import { CorsOptions } from 'cors'; import * as ServeStatic from 'serve-static'; import Command from "../common/command/index"; import { IncomingHttpHeaders } from 'http'; import { ApolloServerExpressConfig } from 'apollo-server-express'; import AbstractCommand from "../domain/abstract/command/index"; export * from 'apollo-server-express/dist'; export declare type HttpAppType = 'express'; export interface ExpressRequestHandler extends ExpressStatic.RequestHandler { } export declare type ExpressPathParams = ExpressCore.PathParams; export declare type ExpressRouter = ExpressCore.Router; export declare type PoweredByOptions = boolean | string; export interface AppSettings { httpAppType: HttpAppType; /** * @default true * * * false to disable * * * true will show express default powered by text * * * string will override express default powered by text */ poweredBy: PoweredByOptions; port: number; host: string; staticOptions?: StaticOptions; jsonBodyParserOptions: OptionsJson; urlencodedBodyParserOptions: OptionsUrlencoded; textBodyParserOptions: OptionsText; corsOptions: CorsOptions; graphql?: GraphQLServerOptions; } export interface GraphQLServerOptions { path: string; expressConfig?: ApolloServerExpressConfig; } export interface StaticOptions { route: string; root: string; options: ServeStatic.ServeStaticOptions; } export interface ExpressApplication extends IExpressApp { type: 'express'; } export interface CommandConstructorFactory { create<T extends Command>(): T; } export interface CommandExecuteParams { headers: IncomingHttpHeaders; input: { [id: string]: any; }; } export interface ExpressHandlerParameters<TCommandArgs extends any, TCommand extends AbstractCommand<TCommandArgs>> { request: ExpressStatic.Request; response: ExpressStatic.Response; command: TCommand; args?: any; } export interface ExpressRouterCreateFactoryParameters { type: 'express'; options?: ExpressStatic.RouterOptions; } export declare type RouterCreateFactoryParameters = ExpressRouterCreateFactoryParameters; export { ExpressStatic }; //# sourceMappingURL=index.d.ts.map