I want to fetch some html via nodejs and fetch the output in my browser , So I used following code
const express = require('express')
const app = express()
const fetch = require("node-fetch");
const port = 3000
app.listen(port, () => console.log(`Example app listening on port ${port}!`));
fetch("https://example.com/results.php") .then(res => res.text())
.then(data => obj = data)
.then(() =>
app.get('/', (req, res) => res.send(obj))
)
Then I started the app using node app
Now When i run localhost:3000 , this gives same output everytime, But https://example.com/results.php is dynamic results page , which returns various result on every reload.
So what i need is Everytime I open localhost:3000 , it must fetch the url again and return new result in browser window , Sorry I am completely new to nodejs , I am just trying to remake php curl from nodejs.