node js fetch
snippet in javascript

node js fetch

user4921

const fetch = require('node-fetch');	//npm install node-fetch

fetch('https://httpbin.org/post', {
  method: 'POST',
  body: 'a=1'
})
  .then(res => res.json())
  .then(json => {
	// Do something...
  })
  .catch(err => console.log(err));

how to install node fetch

user678

$ npm install node-fetch --save

node js fetch

user3392

const fetch = require('node-fetch');