Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const app = ({
routes,
opts,
}: {
routes: string | RouteType[];
opts?: any;
}): Light => {
const g = glob();
(global as any).light = g;
const router = Router({
ignoreTrailingSlash: true,
defaultRoute: (req: IncomingMessage, res: ServerResponse): void => {
res.statusCode = 404;
res.end('Not Found');
},
});
let routeObjs: RouteType[] = [];
if (typeof routes === 'string') {
const files: any[] = findRoutes(routes);
routeObjs = importRoutes(files, routes);
} else {
routeObjs = routes;
}