I need to call a server API to POST some data in custom node's js file. I am trying to use "node-fetch" , but it always gives me " Cannot find module 'node-fetch'" I have installed the module. Module is available under "node_modules" folder.
I am using below line of code to test a simple server call:
const fetch = require('node-fetch');
fetch("some_url").then(res => console.log(res.text()))
.then(body => console.log(body));
Could you please suggest. Also is it a right way to do this?