Easiest Way To Host Front End React Application
I recently had to host a react app and have heard of so many people having issues with it thought I would share my experience with a super easy and quick way to host.
Surge is a super quick and easy development software that you can host with for free, all from your CLI. To start deploying, first install surge.
npm install -g surge
After installing surge you are going to want to prepare you project to deploy by running :
npm run build
Which is built in script that basically packages all of your dependencies, a new folder “build” that contains your project ready to deploy will show up in your project directory. Next, make sure you are in your projects root directory and run
If you are a first time Surge user it will ask you to enter an email and password to create an account. After creating an account you just need to enter your project file path which is most likely autofilled for you, and a domain name. For the project path make sure to add “build” to the end like so
as that build file has your packaged project ready to deploy. Surge will pre-fill a random domain name for you but you can edit it to whatever you choose before hitting enter. Be sure to leave the “.surge.sh” on the end as it is required. After submitting you should be given a domain at the bottom of the CLI and if you visit that address you should see your application!
It’s that easy! If you want to check surge out click here