Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 2.36 KB

README.md

File metadata and controls

60 lines (43 loc) · 2.36 KB

Noroff Assignment API

The Noroff Assignment API will be used to complete each of the assignments using JavaScript Frameworks.

Prerequisites

In order to use the API you will require the following:

  1. Install Git
  2. Install NodeJS LTS with npm (It must be the LTS version.)
  3. Create a Heroku account (free)

Instructions

Follow the below instructions to get your API setup and ready for use.

  1. Fork this repository and clone the forked repository to your computer
  2. Run npm install in the root of the cloned repository
  3. Ensure you have the Heroku CLI Installed by running heroku --version in your terminal app
  4. 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
    • 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
  5. The app will be automatically deployed and started.
  6. Check the terminal for your API's Url.

API Key and Authorization Header

Lastly, on your Heroku Dashboard, open your API application, find the settings tab and look for the Config Vars section

Locate the "Reveal Config Vars" button and click it

img.png

Enter TWO config vars:

NODE_ENV : production
API_KEY : any randomly generated string (64 characters)

See the screenshot below.

img.png

Accessing Endpoints

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.

Trivia Game API

Trivia API Docs

Lost in Translation API

Lost In Translation

Pokémon Trainer API

Pokémon Trainer

Special thanks to Typicode for json-server

Github: json-server