Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/magicdawn/impress-router-table
Sails.js like routing for koa.js
https://github.com/magicdawn/impress-router-table
express-router koa koa-middleware koa-router sails
Last synced: 10 days ago
JSON representation
Sails.js like routing for koa.js
- Host: GitHub
- URL: https://github.com/magicdawn/impress-router-table
- Owner: magicdawn
- License: mit
- Created: 2016-12-02T15:35:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-12T05:04:03.000Z (almost 8 years ago)
- Last Synced: 2024-12-28T07:46:50.390Z (about 1 month ago)
- Topics: express-router, koa, koa-middleware, koa-router, sails
- Language: JavaScript
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# impress-router-table
> Sails.js like routing for koa.js[![Build Status](https://img.shields.io/travis/magicdawn/impress-router-table.svg?style=flat-square)](https://travis-ci.org/magicdawn/impress-router-table)
[![Coverage Status](https://img.shields.io/codecov/c/github/magicdawn/impress-router-table.svg?style=flat-square)](https://codecov.io/gh/magicdawn/impress-router-table)
[![npm version](https://img.shields.io/npm/v/impress-router-table.svg?style=flat-square)](https://www.npmjs.com/package/impress-router-table)
[![npm downloads](https://img.shields.io/npm/dm/impress-router-table.svg?style=flat-square)](https://www.npmjs.com/package/impress-router-table)
[![npm license](https://img.shields.io/npm/l/impress-router-table.svg?style=flat-square)](http://magicdawn.mit-license.org)## Install
```sh
$ npm i impress-router-table --save
```## API
```js
const routing = require('impress-router-table');
```### `routing(rootdir, router)`
returns a koa middleware```js
const app = new (require('koa'))
app.use(routing(__dirname + '/api'))
app.listen(9000)
```#### `router`
router must support `get` / `post` / etc HTTP methods
defaults to an new impress-router instance#### Folder structure in `rootdir`
for example in previous example, `__dirname + '/api'`,
take a look at [test/demo/api/](test/demo/api/)```
test/demo/api
├── controllers
│ ├── PolicyTestController.js
│ └── RouteTestController.js
├── policies
│ ├── auth.js
│ └── bar.js
├── policy.js # policy config
└── routes.js # routes config2 directories, 6 files
```## Changelog
[CHANGELOG.md](CHANGELOG.md)## License
the MIT License http://magicdawn.mit-license.org