0.2.2 • Published 5 years ago

simple-walker v0.2.2

Weekly downloads
112
License
MIT
Repository
github
Last release
5 years ago

simple-walker

simple-walker is a nodejs synchronous walker to search files inside dirs. It's specially designed to load dynamic files, like routes, modules, etc.

Installation

You can download the repository or simply install this module through npm:

npm install simple-walker

Usage

Include the module through import:

import walker from 'simple-walker';

You then have a reference to a function, which takes the following arguments:

walker ( path, dirname, filename );

Whereas path is the location to inspect, dirname is the dirname to search and filename is the filename to search inside dirname.

Example

  // Import the package
  import walker from 'simple-walker';
  
  // Apps endopoints
  const appsRoutes = walker(
    path.join('/project_name', '/apps'),
    'endpoints',
    'routes.js'
  );
  
  export default function(app) {
    // Initialize Express's routes
    for (let route of appsRoutes) {
      app.use(`/api/v1/`, require(route.path));
    }
  }
0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago