How to use fs-routes - 1 common examples

To help you get started, we’ve selected a few fs-routes 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 kogosoftwarellc / open-api / packages / openapi-framework / index.ts View on Github external
paths.forEach(pathItem => {
        if (byString(pathItem)) {
          pathItem = toAbsolutePath(pathItem);
          if (!byDirectory(pathItem)) {
            throw new Error(
              `${
                this.loggingPrefix
              }args.paths contained a value that was not a path to a directory`
            );
          }
          routes = routes.concat(
            fsRoutes(pathItem, {
              glob: this.routesGlob,
              indexFileRegExp: this.routesIndexFileRegExp
            })
              .filter(fsRoutesItem => {
                return this.pathsIgnore
                  ? !this.pathsIgnore.test(fsRoutesItem.route)
                  : true;
              })
              .map(fsRoutesItem => {
                routesCheckMap[fsRoutesItem.route] = true;
                return {
                  path: fsRoutesItem.route,
                  module: require(fsRoutesItem.path)
                };
              })
          );

fs-routes

Scan a filesystem for route files.

MIT
Latest version published 10 months ago

Package Health Score

72 / 100
Full package analysis

Popular fs-routes functions