How To Deploy A React Application On A Static Server

- 1 answer

I have a react application build with create-react-app. Its using octoberCMS as the backend fetching data using Axios calls from the frontend. Till now I was developing keeping the build content of react inside a directory named 'react' in the root directory of octoberCMS installation. Hence the URL I was hitting was

The problem is now I am done with the development phase and look forward to deployment. But I want my front-end to be served at and backend to be served at (backend served as I want). How can I achieve this? I am fairly new to both frameworks.

I have tried keeping the build content along with the rest of the octoberCMS



First build your react app that will give you vendor.js[third party scripts] and your app.js[your actual app]

put them in to theme directory assets something

Then In Ocotber CMS make page with URL /:url? and paste your index.html content there. it will be your root div and including js html, change path for js which points to the build js which you put in theme directory.

now what happens when anybody come to site - we are serving same content as we do in dev build - index.html with root tag and needed js

Now if use hit any other url like it also will be catch by /:url? (and all other requests) and home page served and our react app will work as we needed.

if any questions please comment.