Skip to content

Instantly share code, notes, and snippets.

@smartITNinja
Created December 19, 2017 14:05
Show Gist options
  • Save smartITNinja/6ec8c97ce2a374c885fd3f4ee9f495ab to your computer and use it in GitHub Desktop.
Save smartITNinja/6ec8c97ce2a374c885fd3f4ee9f495ab to your computer and use it in GitHub Desktop.
// npm install apisauce --save
var apisauce = require('apisauce');
const api = apisauce.create({
baseURL: 'https://api.carbonintensity.org.uk'
});
api
.get('/intensity')
.then((response) => response.data)
.then(console.log)
// output ->
// { data:
// [ { from: '2017-12-19T13:30Z',
// to: '2017-12-19T14:00Z',
// intensity: [Object] } ] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment