rg-express
Version:
## User Guide
54 lines (50 loc) • 1.4 kB
TypeScript
import { Router, Express } from 'express';
/**
* Configuration options for setting up application routes.
*
* @property baseDir - The base directory where route files are located.
* @property routeGenIfEmpty - Automatically sets up startup code if the file is empty.
* @property app - An optional Express application instance to use for routing.
*/
interface RouteConfigWithApp {
baseDir: string;
routeGenIfEmpty?: boolean;
/**
* @deprecated Use `routeGenIfEmpty` instead.
*/
autoSetup?: boolean;
/**
* @deprecated skip to pass app.
*/
app: Express;
}
type RouteConfigWithoutApp = string | {
baseDir: string;
routeGenIfEmpty?: boolean;
/**
* @deprecated Use `routeGenIfEmpty` instead.
*/
autoSetup?: boolean;
app?: undefined;
};
interface RouteConfig {
baseDir: string;
routeGenIfEmpty?: boolean;
/**
* @deprecated Use `routeGenIfEmpty` instead.
*/
autoSetup?: boolean;
/**
* @deprecated skip to pass app.
*/
app?: Express;
}
type RoutesProps = string | RouteConfig;
declare function routes(config: RouteConfigWithoutApp): Router;
declare function routes(config: string): Router;
declare function routes(config: RouteConfigWithApp): void;
declare const rg: typeof routes & {
routes: typeof routes;
};
export { rg as default, routes };
export type { RoutesProps };