dekoa
Version:
Decorators for Koa
36 lines (30 loc) • 810 B
JavaScript
import Status from 'http-status-codes'
import { resource, get, post, put, del } from 'route'
import { NewAccount, UpdateAccount, Finder, Upload } from '../schema'
export default class Schema {
async find (ctx) {
const params = ctx.query
ctx.status = Status.OK
ctx.body = { limit: params.limit, offset: params.offset }
}
async upload (ctx) {
ctx.status = Status.CREATED
}
async create (ctx) {
ctx.status = Status.CREATED
ctx.body = { username: 'test@example.com' }
}
async update (ctx) {
ctx.status = Status.OK
ctx.body = { username: 'test@example.com' }
}
async remove (ctx) {
ctx.status = Status.NO_CONTENT
}
}