How to use find-my-way - 1 common examples

To help you get started, we’ve selected a few find-my-way examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ludicrousxyz / light / src / server.ts View on Github external
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;
  }

find-my-way

Crazy fast http radix based router

MIT
Latest version published 5 days ago

Package Health Score

89 / 100
Full package analysis

Popular find-my-way functions