The Noroff Assignment API will be used to complete each of the assignments using JavaScript Frameworks.
In order to use the API you will require the following:
- Install Git
- Install NodeJS LTS with npm (It must be the LTS version.)
- Create a Heroku account (free)
Follow the below instructions to get your API setup and ready for use.
- Fork this repository and clone the forked repository to your computer
- Run
npm install
in the root of the cloned repository - Ensure you have the Heroku CLI Installed by running
heroku --version
in your terminal app - Run the following commands (In the project root directory):
- Remove the cloned repository:
git remote remove origin
- Create a new Heroku App:
heroku create <choose-a-name-for-your-app>
- e.g.
heroku create noroff-assignment-api
- Please note: The name chosen must be unique on the
.herokuapp.com
domain
- e.g.
- Ensure all files are added to git
git add .
- Commit all the files:
git commit -m "FEAT: Heroku"
- Push the files to your heroku app:
git push heroku master
- Remove the cloned repository:
- The app will be automatically deployed and started.
- Check the terminal for your API's Url.
Lastly, on your Heroku Dashboard, open your API application, find the settings tab and look for the Config Vars section
NODE_ENV : production
API_KEY : any randomly generated string (64 characters)
See the screenshot below.
Each API endpoint contains both open and protected endpoints. All GET
endpoints are open. Any other method POST
, PUT
, PATCH
and DELETE
is protected with the X-API-KEY
header.