rename koa2 to koa

This commit is contained in:
DavidCai
2016-01-11 23:23:15 +08:00
parent 890d4d8bfe
commit 96c7488d5f
2 changed files with 1 additions and 1 deletions
+20
View File
@@ -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);