vite-plugin-api-routes
Version:
A Vite.js plugin that creates API routes by mapping the directory structure, similar to Next.js API Routes. This plugin enhances the functionality for backend development using Vite.
17 lines (14 loc) • 487 B
TypeScript
import { ErrorRequestHandler, RequestHandler, Express } from 'express';
type Callback = ErrorRequestHandler | RequestHandler | (ErrorRequestHandler | RequestHandler)[];
type RouteInfo = {
source: string;
method: "get" | "post" | "put" | "push" | "delete" | string;
route: string;
path: string;
url: string;
};
type RouteModule = RouteInfo & {
cb: Callback;
};
declare const handler: Express;
export { type Callback, type RouteInfo, type RouteModule, handler };