Skip to content

Latest commit

 

History

History
46 lines (39 loc) · 2.73 KB

File metadata and controls

46 lines (39 loc) · 2.73 KB

URL Shortener

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 😃👍

How to run?

  • To run the backend server, go into the backend folder, and run install_deps.bat. Once the installation of the required modules is complete, go into the src folder and run run.bat.
  • To run the frontend server, go into the frontend folder, and run install_deps.bat. Once the required modules have been installed, open a new terminal window and run npm start in the same directory as the package.json file.

How to deploy API? - Heroku

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, type web: node index.js
  • Make sure to change the port of your express API to process.env.PORT
  • You must have the node_modules folder 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 create or heroku create {any name you would like
  • Then type git push heroku main, if that doesn't work type git push heroku master

How to deploy API? - Railway

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.json in the frontend's src folder to your newly railway-hosted API URL.