I have an express server on localhost from which I am making an Api call
function get(){
console.log('calling get')
fetch('https://www.nseindia.com/api/marketStatus')
.then(val=>{console.log(val)})
.catch(err => console.log(err))
}
app.listen(3000, () => {
console.log('Listening on Port 3000');
get()
});
the output which I get with using node-fetch is the following and It doesn't throw any kind of an error. It doesn't go inside then or the catch callback.
Listening on Port 3000
calling get
but with axios the code inside the then callback runs fine
function get(){
console.log('calling get')
axios.get('https://www.nseindia.com/api/marketStatus').then(val=>{
console.log(val)
}).catch(error => {
console.log(error)
})
}
app.listen(3000, () => {
console.log('Listening on Port 3000');
get()
});
any Help would be greatly appreciated.
console.log(val)
tryconsole.log('test')