Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created April 8, 2012 18:12
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 isaacs/2338879 to your computer and use it in GitHub Desktop.
Save isaacs/2338879 to your computer and use it in GitHub Desktop.
fs = undefined
http = undefined
longAssBuffer = undefined
longAssString = undefined
pathToABigFile = undefined
server = undefined
pathToABigFile = "./ChangeLog"
fs = require("fs")
http = require("http")
longAssString = fs.readFileSync(pathToABigFile, "utf8")
longAssBuffer = fs.readFileSync(pathToABigFile)
server = http.createServer((req, res) ->
if res.url is "/buffer"
res.end longAssBuffer
else if res.url is "/favicon.ico"
res.writeHead 404
res.end "Not found"
else
res.end longAssString
)
server.listen 1337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment