Last active
August 29, 2015 14:11
-
-
Save aredridel/97a979e343d3984e4562 to your computer and use it in GitHub Desktop.
Refactoring to continuation-passing
This file contains 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
var http = require('http'); | |
var bl = require('bl'); | |
function start(callback) { | |
option = {}; | |
options.path = '/start'; | |
var req = http.request(options, function (res) { res.pipe(bl(callback)) }); | |
req.end(); | |
} | |
start(function (err, startingRoomId) { | |
if (err) { | |
console.warn(err); | |
} else { | |
console.log(startingRoomId.toString()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment