UNPKG

node-fast-server

Version:

It enables you to effortlessly create a high-performance API server built with Node.js and Express.

37 lines (36 loc) 1.25 kB
import { Express } from "express"; import http from 'http'; import { ApiListType, ServerConfig } from "../types"; export declare class FastServer { APP: Express; EXPRESS: any; HTTP: typeof http; apis?: ApiListType[]; config: ServerConfig; /** * * @param apis * An array consisting of JSON objects representing ApiTypes[]. * * @example * [[ {method,name,endpoint,middleware?,contorller}] ] * * * const apis:ApiListType[]=[ * [{method:"POST",name:"cutomApi",endpoint:"cutomApi",contorller:cutomApi.controller}, * [{method:"GET",name:"cutomApi1",endpoint:"cutomApi1",contorller:cutomApi.controller1}, * * ], * [{method:"GET",name:"cutomApi3",endpoint:"cutomApi3",middleware:customApi3.middleware,contorller:cutomApi3.controller}] * * ] */ constructor(apis?: ApiListType[], config?: ServerConfig); STARTSERVER(): void; USE(): void; LISTEN(): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>; ACTIVE_CORS(): void; ACTIVE_WS(): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>; ACTIVE_SHARE_FOLDERS(foldername: string): void; LISTEN_API(apis: ApiListType[]): void; }