Created
August 8, 2015 23:21
-
-
Save edhaase/91862e2e2ecc9725172f to your computer and use it in GitHub Desktop.
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
var koa = require('koa'); | |
var app = koa(); | |
var router = require('koa-router')(); | |
var util = require('util'); | |
var compress = require('koa-compress') | |
app | |
.use(compress({ | |
threshold: 5, | |
flush: require('zlib').Z_SYNC_FLUSH | |
})) | |
.use(router.routes()) | |
.use(router.allowedMethods()); | |
router['get']('/', function *(next) { | |
this.body = 'Hello World'; | |
}); | |
router['put']('/', function *(next) { | |
this.body = 'Hello World'; | |
}); | |
// Clearing the router works the same. | |
// router.stack = []; | |
console.log(util.inspect(router, {depth: null, color: true})); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment