reactjs – How to expose a Rest endpoint on a React.js App

Is there any way to expose a rest endpoint on a React.js app? e.e., some page within my React app that returns a json.
I couldn’t find any clue anywhere, and I honestly have no idea where to start, if this is even possible. Maybe can’t be done by altering the root index.html, maybe hacking the html responde via Javascript?

An idea I had, since the json in the /public directory can be served, is to create a json locally with fs. But I don’t want to write any files.

My question is: is this possible, and if yes what is the best procedure to obtain it?

Read more here: Source link