Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@geta6
Created January 8, 2014 04:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save geta6/8311877 to your computer and use it in GitHub Desktop.
Save geta6/8311877 to your computer and use it in GitHub Desktop.
'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