Created
February 20, 2018 16:02
-
-
Save markwithers/31f8a43df6db7c1656441fec0fec1285 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const Future = require('fluture') | |
const got = require('got') | |
const futureFetch = (url, options) => { | |
return new Future((reject, resolve) => { | |
got(url, options).then(resolve).catch(reject) | |
}) | |
} | |
futureFetch( | |
{ protocol: 'http:', port: 8080, path: '/api', host: 'localhost' }, | |
{ json: true } | |
).fork(console.error, res => console.log(res.body.message)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment