how to use fetch in node js

JavaScript
$ npm install node-fetch --saveconst fetch = require('node-fetch');	//npm install node-fetch

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

Also in JavaScript: