-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
42 lines (37 loc) · 1.25 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Joi = require("@hapi/joi");
import { RequestHandler, Express, Router, ErrorRequestHandler } from "express";
type ControllerLoaderOption = {
filePath: string;
debug?: boolean;
autoInjectRoutes?: boolean;
};
type ValidatorOption = {
query?: Joi.Schema;
body?: Joi.Schema;
params?: Joi.Schema;
};
type BeforeRouterInjectMiddleware = {
active: Boolean | Function;
middleware: RequestHandler;
};
declare namespace expressTsDecorator {
export class ExpressApp {
_express: Express;
routes: Router[];
beforeRouterInjectMiddlewares: Array<
RequestHandler | BeforeRouterInjectMiddleware
>;
constructor(app: Express);
get express(): Express;
use(...args: Array<RequestHandler | ErrorRequestHandler>): void;
}
export function Controller(path: string): ClassDecorator;
export function ControllerLoader(option: ControllerLoaderOption);
export function Get(path: string): MethodDecorator;
export function Put(path: string): MethodDecorator;
export function Delete(path: string): MethodDecorator;
export function Post(path: string): MethodDecorator;
export function Validator(option: ValidatorOption): MethodDecorator;
export function Middlewares(...middlewares: RequestHandler[]);
}
export = expressTsDecorator;