node-fast-server
Version:
It enables you to effortlessly create a high-performance API server built with Node.js and Express.
37 lines (28 loc) • 722 B
text/typescript
import { NextFunction,Response,Request } from "express"
export type ApiType={
method:'GET'|'POST'|'PUT'|'DEL',
name:string,
endpoint:string,
controller:(req: Request, res: Response)=>Promise<void> | void,
middleware?:(req: Request, res: Response, next: NextFunction)=>Promise<void>
}
export interface MiddlewareRequest extends Request {
u?:{
payload: any,
error:any,
body: any
}
}
export type ApiListType=ApiType[]
export enum serverType{
Develop="Develop",
Production="Production"
}
export type ServerConfig={
HOST?:string;
SERVER_PORT:number;
WS_PORT?:number;
SERVER_TYPE:serverType,
PUBLİC_FOLDER_NAME:string,
PREFIX:string
}