diff --git a/Readme.md b/Readme.md index 8d5b849..59e1553 100644 --- a/Readme.md +++ b/Readme.md @@ -1,5 +1,5 @@ # koa-better-static2 -[![Node version](https://img.shields.io/node/v/koa-better-static2.svg?style=flat)](http://nodejs.org/download/) +[![Node version](https://img.shields.io/badge/Node-8.0.0-blue.svg)](http://nodejs.org/download/) [![Koajs deps](https://img.shields.io/badge/Koajs-2.3.0-brightgreen.svg)](https://github.com/koajs/koa) [![Build Status](https://travis-ci.org/uniibu/koa-better-static2.svg?branch=master)](https://travis-ci.org/uniibu/koa-better-static2) [![David deps](https://david-dm.org/uniibu/koa-better-static2.svg)](https://david-dm.org/uniibu/koa-better-static2) diff --git a/example.js b/example.js index 714fa8e..997c4c1 100644 --- a/example.js +++ b/example.js @@ -1,23 +1,15 @@ - 'use strict'; - const serve = require('./'); const Koa = require('koa'); const app = new Koa(); - // $ GET /package.json // $ GET / - app.use(serve('.')); - -app.use((ctx, next) => { - return next().then(() => { - if ('/' == ctx.path) { - ctx.body = 'Try `GET /package.json`'; - } - }); -}) - +app.use(async (ctx, next) => { + await next(); +if ('/' == ctx.path) { + ctx.body = 'Try `GET /package.json`'; +} +}); app.listen(3000); - -console.log('listening on port 3000'); +console.log('listening on port 3000'); \ No newline at end of file