I want to trigger a client side function Javascript, with Nodejs
I’m trying to get a response from the Nodejs to display data on my website
A program will send an API to my Nodejs Api example(htpp://localhost:3000/apiResponse) containing some data
I want to get the API data to my frontend
How can i do this, or is there another way to trigger a function o value when a API send to me?
2
Answers
You can use the browser native
fetch
function to call your API:or
If I understood your situation correctly, this is how I would handle it.
Note how the request url from the front-end is the same as the node
GET
path -> "apiResponse". I hope this helps.