# koa-routed

> Route decorator for koa.

Latest version **1.0.4** (published 2018-02-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-routed
pnpm add koa-routed
yarn add koa-routed
bun add koa-routed
```

## 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.0.4 |
| Published | 2018-02-28 |
| First published | 2018-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Cooper Hsiung |
| Maintainers | cooperhsiung |
| Keywords | route, decorator, koa |

## Links

- npm: https://www.npmjs.com/package/koa-routed
- Repository: https://github.com/cooperhsiung/koa-routed
- Homepage: https://github.com/cooperhsiung/koa-routed#readme
- Issues: https://github.com/cooperhsiung/koa-routed/issues
- npm.io page: https://npm.io/package/koa-routed

## Dependencies (1)

- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^2.1.0

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-02-28
- 1.0.3 — 2018-02-09
- 1.0.2 — 2018-02-09
- 1.0.1 — 2018-02-09
- 1.0.0 — 2018-02-09

## README

# koa-routed

Route decorator for koa.

## Installation

babel is required.
 - babel-preset-es2017
 - babel-plugin-transform-decorators-legacy
 
```bash
$ npm i koa-routed -S
```

## Run

```js
require('babel-register');
require('./app.js');
```
or
```bash
npm run build & npm start
```


## Example


```js
const routed = require('koa-routed');
const Koa = require('koa');
const app = new Koa();

const person = {

    @routed('/hello')
    sayHello(ctx, next) {
        ctx.body = 'Hello!'
    },

    @routed('/hi', {method:'post'})
    sayHi(ctx, next) {
        ctx.body = 'Hi!'
    }
};

app.use(person.sayHello);
app.use(person.sayHi);

app.listen(3000);
console.log('listening on port 3000');
```

## License

MIT

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