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.
19 lines (18 loc) • 394 B
JavaScript
// src/api-server/routers.ts
import * as configure from "vite-plugin-api-routes/configure";
var routeBase = "/api";
var internal = [];
var routers = [];
var endpoints = [];
var applyRouters = (applyRouter) => {
internal.forEach((it) => {
it.cb = configure.callbackBefore?.(it.cb, it) || it.cb;
applyRouter(it);
});
};
export {
applyRouters,
endpoints,
routeBase,
routers
};