# restify-route-loader

> A module to automate route loading for [Restify](https://github.com/restify/node-restify).

Latest version **2.4.0** (published 2018-04-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install restify-route-loader
pnpm add restify-route-loader
yarn add restify-route-loader
bun add restify-route-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 | 2.4.0 |
| Published | 2018-04-15 |
| First published | 2016-06-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | iamchristopher |
| Maintainers | iamchristopher |

## Links

- npm: https://www.npmjs.com/package/restify-route-loader
- Repository: https://github.com/iamchristopher/restify-route-loader
- Homepage: https://github.com/iamchristopher/restify-route-loader#readme
- Issues: https://github.com/iamchristopher/restify-route-loader/issues
- npm.io page: https://npm.io/package/restify-route-loader

## Dependencies (3)

- [glob](https://npm.io/package/glob.md) 7.1.2
- [colors](https://npm.io/package/colors.md) 1.1.2
- [semver](https://npm.io/package/semver.md) 5.4.1

## Recent versions

- 2.4.0 (latest) — 2018-04-15
- 2.1.0-rc4 (beta) — 2017-07-22
- 2.3.1 — 2018-04-08
- 2.3.0 — 2018-04-07
- 2.2.0 — 2017-09-30
- 2.1.1 — 2017-07-22
- 2.1.0 — 2017-07-22
- 2.1.0-rc3 — 2017-07-22
- 2.1.0-rc2 — 2017-07-22
- 2.1.0-rc1 — 2017-07-22
- 2.0.1 — 2017-06-17
- 2.0.0 — 2017-06-17
- 1.0.0 — 2016-06-20

## README

# restify-route-loader
A module to automate route loading for [Restify](https://github.com/restify/node-restify).

## Installation
```
npm i restify-route-loader -S
```

## Usage
```js
import restify from 'restify';
import routeLoader from 'restify-route-loader';

const server = restify.createServer();

server.use(routeLoader(server));

server.listen(port, () => {});
```
## Folder Structure

```
-/routes
--get.js
--/aboutus
---get.js
---post.js
```

```
-/routes
--get-1.0.0.js
--get-1.1.0.js
--/aboutus
---get.js
---post.js
```

## File Setup
If the file is just the verb without the version, include the version within the file
```
exports.default = [
  {
    version: "1.0.0",
    controller: function(req, res, next) {
      return res.send('Hello World')
    }
  }
]
```


## Configuration
The module accepts a configuration object as an optional second parameter.

```js
server.use(routeLoader(server, {
    routes: path.join(__dirname, 'routes')
}));
```

### Options
__routes__ &mdash; Change the folder to look for routes
- Defaults to `routes/` inside the current working directory

__verbs__ &mdash; Enable loading of additional HTTP methods
- Must be supported by Restify
- Defaults to `get`, `post`, `del`, `put`

## TODO
- [x] Update (create) documentation  
- [x] Add build process

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