Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
uniibu committed Jul 12, 2017
1 parent 7bdf2a7 commit 4d76fe8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
22 changes: 7 additions & 15 deletions example.js
Original file line number Diff line number Diff line change
@@ -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');

0 comments on commit 4d76fe8

Please sign in to comment.