# @abnerlin/express-routes-loader

> Load express route by given .js path, and the route file must export the property "root" which is the url path. This tool also provide the feature to load all routes in directory which provided as the first argument.

Latest version **2.0.1-readme** (published 2018-01-24) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @abnerlin/express-routes-loader
pnpm add @abnerlin/express-routes-loader
yarn add @abnerlin/express-routes-loader
bun add @abnerlin/express-routes-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.0.1-readme |
| Published | 2018-01-24 |
| First published | 2018-01-24 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | AbnerLin |
| Maintainers | abnerlin |
| Keywords | routes, express, loader |

## Links

- npm: https://www.npmjs.com/package/@abnerlin/express-routes-loader
- Repository: https://github.com/AbnerLin/express-routes-loader
- Homepage: https://github.com/AbnerLin/express-routes-loader#readme
- Issues: https://github.com/AbnerLin/express-routes-loader/issues
- npm.io page: https://npm.io/package/@abnerlin/express-routes-loader

## Recent versions

- 2.0.1-readme (latest) — 2018-01-24
- 2.0.0-rc.1 — 2018-01-24
- 2.0.0 — 2018-01-24

## README

# Express Routes Loader

    Load all routes in directory.

## Installation
    
    npm install @abnerlin/express-routes-loader


## Usage
    
```
const app = express();
const expressRouteLoader = require('@abnerlin/express-routes-loader')(app);
    
...

```

### Load all routes in direcotry

```
expressRouteLoader.dir(path.join(__dirname, 'routes')); // which 'routes' is directory path.
```

### Load routes with specify file

```
expressRouteLoader.file(path.join(__dirname, 'routes', 'auth')); // which 'routes/auth' is file path.

```

### Export url path
```
const express = require('express');
const router = express.Router();

router.post('/login', function(req, res) {
        ...
});

router.root = '/auth';  // this is url path which must export.

module.exports = router;
```

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