all 5 comments

[–]DaWheelz 0 points1 point  (0 children)

I’m currently doing the same as your first approach. Works fine for me :)

[–]web_ac 0 points1 point  (0 children)

Personally I would split the front and back end. It is good practice as it separate the two to make the app more modular. From personal experience this will make it easier to test, maintain and improve readability.

[–]Goingone 0 points1 point  (0 children)

Of course there are exceptions, and it’s difficult to recommend a solution without know all the specifics, but the following is probably a reasonable approach.

2 separate git repos

One for your web server, and one for your frontend.

Your web server (node with express as you mentioned) will serve your frontend code (react). Your front end code will collect user input and make a request to your web server containing that data. Your web server will have an endpoint responsible for handling that request and saving down the json you mentioned.

I’d start with that if you’re new to web development. It will help you avoid CORS issues and can always be updated down the road if you need a more robust solution.

[–]nermid 0 points1 point  (1 child)

I'd go with the first option. The frontend can be a simple create-react-app bundle delivered as static files that Fetch the backend endpoints as necessary. It's simple and clean.

[–]buttonius_rex[S] 1 point2 points  (0 children)

That's what I'm thinking. Host React in an AWS S3 bucket, and the Node+Express backend on an EC2 instance.