I want to send two API data to the HTML file using Axios But I can not figure out the problem please help me with that My code is
app.get('/', (req, res) => {
const Url1 = "https://api.covidindiatracker.com/state_data.json";
const x = axios.get(Url1).then((response1) => {
res.render("index", {
appName: "COVID-19 Tracker",
pageName: "India Fights Corona",
data1: response1.data
});
})
});
app.get('/', (req, res) => {
const Url2 = "https://api.covidindiatracker.com/total.json";
const y = axios.get(Url2).then((response2) => {
res.render("index", {
data2: response2.data
});
})
});
in my HTML page
<h3><%= JSON.stringify(data1.recovered) %></h3>
and
<td><%= data2.id %></td>
Why it not work please help me