Might not be very efficient if you're hosting it on places like heroku and railway where they give you long links, but if you get a domain and everything, it works 😃👍
- To run the backend server, go into the
backendfolder, and runinstall_deps.bat. Once the installation of the required modules is complete, go into thesrcfolder and runrun.bat. - To run the frontend server, go into the
frontendfolder, and runinstall_deps.bat. Once the required modules have been installed, open a new terminal window and runnpm startin the same directory as thepackage.jsonfile.
Limitations:
- Will reset database, every time API restarts.
- API goes to sleep after a certain amount of inactivity.
Procedure:
- Download the heroku CLI
- Download Git (Make sure to 'add to PATH')
- Once downloaded, open up your terminal and type
heroku login - Make a new file called
Procfile(with no extension) and in that file, typeweb: node index.js - Make sure to change the port of your express API to
process.env.PORT - You must have the
node_modulesfolder when deploying. - Open a new terminal and navigate to the directory with the API in it.
- Type
git init - Type
git add . - Type
git commit -m "anything you want, or you could just leave this as is" - Type
heroku createorheroku create {any name you would like - Then type
git push heroku main, if that doesn't work typegit push heroku master
Procedure:
- Create a github repository, and upload the files for frontend and backend in separate branches.
- Create an account at https://railway.app/, and link your github account (https://railway.app/account).
- Go to the dashboard (https://railway.app/dashboard), and click
New Project. - Click
Deploy From Repo - Select the github repository you saved your code to, and select the correct branch
- Click
Deploy, sit back, and relax - Don't forget to change the baseURL in the
config.jsonin thefrontend'ssrcfolder to your newly railway-hosted API URL.