0
import {Router} from 'express'
import fetch from 'node-fetch'

const tasks=Router()

tasks.get('/', async (req,res) => {
const response= fetch('https://dummy-api')
res.json(response)
})

I am getting the error,ERR_TLS_CERT_ALTNAME_INVALID . Adding process.env.NODE_TLS_REJECT_UNAUTHORIZED=1 solved the issue but its not secure to use. Is there any other alternative?

  • Is the API you calling under your control? If not then you cant do anything about it. `https://dummy-api` is not a valid FQDN. Your censoring makes it hard to help you correctly. – Marc Mar 16 '23 at 12:35
  • The original api that I am using is a valid one.Its not the one that I mentioned here. I cannot make any changes to the api / response as such. – Sravya Chebolu Mar 16 '23 at 13:21

0 Answers0