2021-02-17 01:49:07 +08:00
|
|
|
import { Context, Next } from "koa";
|
2021-02-10 03:40:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
export class Index {
|
|
|
|
static async index(ctx: Context, next: Next): Promise<any> {
|
|
|
|
ctx.body = "This is Home!"
|
|
|
|
await next()
|
|
|
|
}
|
|
|
|
|
|
|
|
static async json(ctx: Context, next: Next): Promise<any> {
|
|
|
|
ctx.type = "json"
|
|
|
|
ctx.body = {
|
|
|
|
code: "200",
|
|
|
|
message: "This is Home!",
|
|
|
|
}
|
|
|
|
await next()
|
|
|
|
}
|
|
|
|
|
|
|
|
static async view(ctx: Context) {
|
|
|
|
await ctx.render("index", {
|
|
|
|
name: "titor",
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|