Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

common-coffee

View common-coffee
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# with common-node
httpclient = require "httpclient"
exports.app = ->
status: 200
headers: {}
body: new httpclient.HttpClient(url: "http://google.com").finish().body
 
# without
http = require "http"
http.createServer((req, res) ->
res.writeHead 200, {}
http.get
host: "google.com"
port: 80
path: "/"
, (r) ->
chunks = []
r.on "data", (chunk) ->
chunks.push chunk
r.on "end", ->
chunks.forEach (chunk) ->
res.write chunk
res.end()
).listen 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.