https://github.com/zweifisch/koa-sleepy
router for building RESTful api
https://github.com/zweifisch/koa-sleepy
Last synced: about 1 month ago
JSON representation
router for building RESTful api
- Host: GitHub
- URL: https://github.com/zweifisch/koa-sleepy
- Owner: zweifisch
- Created: 2018-08-22T16:45:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-22T16:59:02.000Z (over 6 years ago)
- Last Synced: 2024-10-29T13:59:10.254Z (7 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# koa-sleepy
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Node.js Version][node-version-image]][node-version-url]router for building RESTful api
```js
const Koa = require('koa')
const {restify} = require('koa-sleepy')class User {
list (ctx, id) {}
create (ctx) {}
retrive (ctx, id) {}
update (ctx, id) {}
replace (ctx, id) {}
destory (ctx, id) {}
more(ctx, id) {}
}
const app = new Koa()
app.use(restify('/users', User))
app.listen()
```to register multiple resources
```js
app.use(restify({
'/users': User,
'/comments': Comment
}))
```[npm-image]: https://img.shields.io/npm/v/koa-sleepy.svg?style=flat
[npm-url]: https://npmjs.org/package/koa-sleepy
[travis-image]: https://img.shields.io/travis/zweifisch/koa-sleepy.svg?style=flat
[travis-url]: https://travis-ci.org/zweifisch/koa-sleepy
[node-version-image]: https://img.shields.io/node/v/koa-sleepy.svg
[node-version-url]: https://nodejs.org/en/download/