Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: dasu
node v4.9.1
version:
1.0.0
endpoint
share
tweet
var dasu = require("dasu") var req = dasu.req // same params as Node's require('http').request var params = { method: 'GET', protocol: 'https', hostname: 'uinames.com', port: 80, path: '/api/' } req(params, function (err, res, data) { console.log(res.headers) var json = JSON.parse(data) console.log(json) // eg: {"name":"Milica","surname":"Maslo","gender":"female","region":"Slovakia"} }) req({ // method: 'GET', // default // protocol: 'http' // window.location.protocol by default hostname: 'api.ipify.org', // window.location.hostname by default // port: 80 // window.location.port by default // path: '/' // default }, function (err, res, data) { console.log(res.headers) console.log(data) })
Created from: https://runkit.com/npm/dasu
Loading…
no comments
sign in
to comment