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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. Since I'm not familiar with webpack, do you know a good resource for a start using this stack?
@StefanBadi Yes look on youtube for LevelupTuts. It's a great source for everthing with react.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.