Created
January 8, 2014 04:35
-
-
Save geta6/8311877 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'use strict' | |
koa = require 'koa' | |
app = koa() | |
router = require 'koa-router' | |
logger = (format = ':method :url') -> | |
return (next) ->* | |
str = format | |
.replace(':method', @method) | |
.replace(':url', @url) | |
process.stdout.write "#{str}\n" | |
yield next | |
app.use logger() | |
app.use router app | |
app.get '/:text', (next) ->* | |
@body = yield =>* | |
return @params.text | |
app.listen 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment