UNPKG

dazjsx

Version:

参考nestjs,基于KOA2的一款轻量级的后端开发框架

52 lines (51 loc) 1.55 kB
import { Context, Middleware, DefaultState, DefaultContext } from 'koa'; import { ConnectionOptions } from 'typeorm'; import { PostgresConnectionCredentialsOptions } from 'typeorm/driver/postgres/PostgresConnectionCredentialsOptions'; import { HttpMethod, Param } from '..'; export declare type DContext<T = unknown> = { proBody?: T; errorMessage?: string; } & Context; export declare type RouteType = { method: HttpMethod; path: string; }; export declare type ParamType = { key: string; index: number; type: Param; name: string; }; export declare type MethodPrototype = { name: string; methodFn: MethodDecorator; }; export declare type Constructor<T = unknown> = new (...args: unknown[]) => T; export declare type KoaListenOption = [ port: number, hostname?: string, backlog?: number ]; export declare type ControllerOptions = { prefix?: string; skipJwt?: boolean; }; export declare type IocOption<T = unknown> = { useFactory?: (...args: unknown[]) => T; inject: Constructor[]; }; export declare type TypeOrmCon = ConnectionOptions & PostgresConnectionCredentialsOptions; export declare type JwtOption = { secret: string; expiresIn: string; }; export declare type JwtLoginOption = { keys: string[]; }; export declare type MainExportOption = { log?: string[]; }; export declare type DMiddleware = Middleware<DefaultState, DefaultContext, unknown>; export declare type ScopOption = { scop: 'root' | 'any'; };