-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be504ad
commit 7cc32cc
Showing
1 changed file
with
13 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
|
||
'use strict'; | ||
'use strict' | ||
|
||
const conditional = require('./'); | ||
const etag = require('koa-etag'); | ||
const Koa = require('koa'); | ||
const app = new Koa(); | ||
const conditional = require('.') | ||
const etag = require('koa-etag') | ||
const Koa = require('koa') | ||
const app = new Koa() | ||
|
||
// use it upstream from etag so | ||
// that they are present | ||
|
||
app.use(conditional()); | ||
app.use(conditional()) | ||
|
||
// add etags | ||
|
||
app.use(etag()); | ||
app.use(etag()) | ||
|
||
// respond | ||
|
||
app.use((ctx, next) => { | ||
return next().then(() => { | ||
ctx.body = { | ||
name: 'tobi', | ||
species: 'ferret', | ||
age: 2 | ||
}; | ||
}); | ||
} | ||
}) | ||
}) | ||
|
||
app.listen(3000); | ||
|
||
console.log('listening on port 3000'); | ||
app.listen( | ||
3000, | ||
console.log('listening on port 3000') | ||
) |