0

I have an existing backend with a REST API written using node.js/express. I can call urls e.g. /getallhouses and get the corresponding JSON object. Using a mobile app, this is rather straightforward as you just call the REST API and process the data. As I need to also add a webapp e.g. with React.js, it seems more murky.

What is the best way of implementing this webapp strategy?

Creating a stand-alone react.js app which will be called by the user first and then is using the REST API like a mobile app and hosting that react.js app on a different server? Or is it better to start from the already existing express/node backend and serving the initial index.html file by

res.sendFile(path.join(__dirname + 'views/index.html'));

and putting all react.js related code into views and letting the backend serving the required react.js app to the user?

codebird456
  • 505
  • 8
  • 19

1 Answers1

1

The best way is probably that you create a react app with redux and compile it to a bundle with something like webpack. Then you could host your page completely static.

MaddEye
  • 691
  • 4
  • 17