From 9cc2dff20b80721e8311401ee9be2b143b22c8f1 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Sat, 12 Mar 2016 20:10:00 -0700 Subject: [PATCH] Added semicolons to README v2 alpha example --- Readme.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Readme.md b/Readme.md index ba7fe8d..9b73d10 100644 --- a/Readme.md +++ b/Readme.md @@ -26,22 +26,22 @@ $ npm install koa ```js // Koa application is now a class and requires the new operator. -const app = new Koa() +const app = new Koa(); // uses async arrow functions app.use(async (ctx, next) => { try { - await next() // next is now a function + await next(); // next is now a function } catch (err) { - ctx.body = { message: err.message } - ctx.status = err.status || 500 + ctx.body = { message: err.message }; + ctx.status = err.status || 500; } -}) +}); app.use(async ctx => { - const user = await User.getById(ctx.session.userid) // await instead of yield - ctx.body = user // ctx instead of this -}) + const user = await User.getById(ctx.session.userid); // await instead of yield + ctx.body = user; // ctx instead of this +}); ``` To learn more about Koa v2, follow [this issue](https://github.com/koajs/koa/issues/533). To try Koa v2, `npm install koa@next`.