0.1.1-alpha.0 • Published 6 years ago

koa-sleepy v0.1.1-alpha.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

koa-sleepy

NPM Version Build Status Node.js Version

router for building RESTful api

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

app.use(restify({
    '/users': User,
    '/comments': Comment
}))