Should I include my Reactjs app in the same application as my REST API?
I am new to Reactjs. I have built a few standalone Node REST APIs. I am building a React app, an Android app and an iOS app (so the REST API needs to service all three applications). I was wondering what convention dictates when building the Node API.
There are 2 options as I see it...
1) I could build one large application that encompasses the REST API and React App. This app would service all the API calls from the mobile apps and react/web app. It would also serve all the views aka HTML, CSS, etc..
OR
2) I could build two smaller apps. One would serve the React app with the view templates with a separate (lighter) Node server. The second app would not hold any views. It just work as a JSON API to serve all three apps.
I would recommend going with an isomorphic application. Check out this boiler plate: react-redux-universal-hot-example.
In your project, you can have two ports running: one for rendering your react views (I prefer server side rendering to provide faster web rendering) and the other for apis and web sockets.
Your mobile apps can also use the api/ws server for RESTful services.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With