dekoa
Version:
Decorators for Koa
46 lines (39 loc) • 696 B
JavaScript
import Status from 'http-status-codes'
import {
resource,
get,
post,
head,
options,
trace,
patch
} from 'route'
export default class Account {
async findById (ctx) {
ctx.status = Status.OK
ctx.body = { username: 'test@example.com' }
}
async create (ctx) {
ctx.status = Status.CREATED
ctx.body = { username: 'test@example.com' }
}
async head (ctx) {
ctx.status = Status.OK
}
async options (ctx) {
ctx.status = Status.OK
}
async trace (ctx) {
ctx.status = Status.OK
}
async patch (ctx) {
ctx.status = Status.OK
}
}