mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-10 11:40:16 +08:00
rename koa2 to koa
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/// <reference path="koa.d.ts" />
|
||||
import * as Koa from "koa";
|
||||
|
||||
const app = new Koa();
|
||||
|
||||
app.use((ctx, next) => {
|
||||
const start: any = new Date();
|
||||
return next().then(() => {
|
||||
const end: any = new Date();
|
||||
const ms = end - start;
|
||||
console.log(`${ctx.method} ${ctx.url} - ${ms}ms`);
|
||||
});
|
||||
});
|
||||
|
||||
// response
|
||||
app.use(ctx => {
|
||||
ctx.body = "Hello World";
|
||||
});
|
||||
|
||||
app.listen(3000);
|
||||
Reference in New Issue
Block a user