Scenario is, I have an existing Node Js Monolithic App with simple HTML ( No Front-end Framework is used ) . Now I have created a better front-end with React JS and want to embed the React JS Build in NODE Js APP.
APP-1 : Node Js with HTML ( Monolithic )
APP-2 : React JS Frontend ( UI only, Interacting with APP-1 as its backend )
There is also an option of running these two apps on different instances on Server but that will cost alot. I want to use a single project ( instance ) with React Js embedded in it.
My approach for now which is very bad: I have added build folder in NODE JS app and created the redirect to the build folder when someone visits NodeApp.com/index
Drawback: When someone visits a route other than index i.e NodeApp.com/xyz this will take to the NodeApp old UI in HTML. I can't redirect all the routes manually as most of them are dynamic.
What's the best approach for this, where should I start?