Skip to content

Instantly share code, notes, and snippets.

@naneau
Created March 17, 2011 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naneau/874392 to your computer and use it in GitHub Desktop.
Save naneau/874392 to your computer and use it in GitHub Desktop.
http = require 'http'
host = '127.0.0.1'
port = 10000
server = http.createServer (request, response) ->
# We expect unicode
request.setEncoding 'utf8'
# Parse body
body = ''
request.on 'data', (chunk) ->
body += chunk
# Request is complete
request.on 'end', () ->
console.log "Ping: #{body}"
# End response
response.statusCode = 200
response.end 'PONG'
server.listen port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment