From b16d37db98cfcd6307a74d0ef8d98ebea4db4feb Mon Sep 17 00:00:00 2001 From: shidianxia Date: Fri, 18 Nov 2016 13:52:41 +0800 Subject: [PATCH] Update example server.js Koa server example doesn't work with current version of koa and koa-router. --- examples/server.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/server.js b/examples/server.js index 2a01727..b152ad1 100644 --- a/examples/server.js +++ b/examples/server.js @@ -3,7 +3,7 @@ var amazon = require('../'), router = require('koa-router'); var app = koa(); -app.use(router(app)); +var api = router(); var client = amazon.createClient({ @@ -21,4 +21,8 @@ app.get('/amazon/:index', function* () { }); }); -app.listen(3000); \ No newline at end of file +app + .use(api.routes()) + .use(api.allowedMethods()); + +app.listen(3000);