# node-simple-module-loader

> A simple lookup for node "modules" within a specific directory

Latest version **1.2.1** (published 2016-08-23) · GPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install node-simple-module-loader
pnpm add node-simple-module-loader
yarn add node-simple-module-loader
bun add node-simple-module-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2016-08-23 |
| First published | 2016-02-09 |
| Weekly downloads | 0 |
| License | GPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Tony Wolf |
| Maintainers | tonix |
| Keywords | expressjs |

## Links

- npm: https://www.npmjs.com/package/node-simple-module-loader
- Repository: https://github.com/twolfy/node-simple-module-loader
- Homepage: https://github.com/twolfy/node-simple-module-loader#readme
- Issues: https://github.com/twolfy/node-simple-module-loader/issues
- npm.io page: https://npm.io/package/node-simple-module-loader

## Dependencies (3)

- [walk](https://npm.io/package/walk.md) ^2.3.9
- [express](https://npm.io/package/express.md) ^4.13.4
- [coffee-script](https://npm.io/package/coffee-script.md) ^1.10.0

## Recent versions

- 1.2.1 (latest) — 2016-08-23
- 1.2.0 — 2016-08-23
- 1.1.0 — 2016-05-14
- 1.0.0 — 2016-02-09

## README

# taskFinder
A simple lookup for node "modules" within a specific directory

# The idea

The [express](http://expressjs.com) Framework is a great piece of software, easy to use and reliable.
I use the taskFinder module to lookup "tasks" within a directory, where one task is a javascript-node-module (so it has to be a .js file!).
After all js files are found, the taskFinder is able to create express routes for these "tasks" and will connect these tasks within express.


# What are tasks?

Each task can provide multiple methods and has to export at least 3 functions:

* taskRoute() // returns the route string, which is to be registered within express
* taskMethods() // returns an array of supported methods
* one of runGetTask(req, res), runPostTask(req, res) // handles the request itself


# Specify param validation

```javascript
module.exports = {
  description: 'Book store module',
  routes: [
    {
      route: '/v1/book/:id',
      method: 'GET',
      call: (req, res) => { return getBook(req, res) },
      params: {
        required: {
          id: (i) => parseInt(i) > 0
        }
      }
    }
  ]
}
```

---
_Source: https://npm.io/package/node-simple-module-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
