In order to use this API for your front end project you will need to fork this repo and host following the instructions below.
This repo is setup to be hosted on heroku. Follow the steps below to get your own copy of the api up and running.
Install the heroku cli if you haven't already.
npm i heroku -g
Log into Heroku using their command line interface:
heroku login
Clone your fork of this repo and cd
into the new directory. From there create an app on heroku using the cli.
heroku create your-app-name
Here your-app-name
should be the name you want to give your application. If you don't specify an app name, you'll get a random one which can sometimes be a bit iffy.
This command will both create an app on Heroku for your account. It will also add a new remote
to your git repository.
Check this by looking at your git remotes:
git remote -v
git push heroku main
Go to the heroku site and log in.
- Select your application
Configure Add-ons
- Choose
Heroku Postgres
The free tier will be adequate for our purposes. This will provide you with a postgreSQL
pre-created database!
Check that the database exists. Click settings
on it, and view the credentials. Keep an eye on the URI. Don't close this yet!
Check that your database's url is added to the environment variables on Heroku:
heroku config:get DATABASE_URL
If you are in your app's directory, and the database is correctly linked as an add on to Heroku, it should display a DB URI string that is exactly the same as the one in your credentials.
Make sure to run the seed prod script from your package.json
:
npm install
npm run seed-prod
heroku open
Any issues should be debugged with:
heroku logs --tail