Description: This was a school project and the exercise consisted of building a REST API that communicates with a JSON file of our own choice. My JSON file is a list of ultimatate songs of all time where every oject has a unique id, a title, artist and year.
MET REQUIREMENTS: x Projektet innehåller minst 4 st. endpoints (GET, POST, PUT & DELETE för en resurs): ------> CHECK x Samtliga endpoints skall kunna nås via en REST Client fil (.rest|.http): ------> CHECK x All data skall vara sparad i en JSON-fil: ------> CHECK x Datan i JSON-filen skall uppdateras då något läggs till, uppdateras eller tas bort: ------> CHECK x APIét ska svara med 404 om datan saknas.: ------> CHECK x Git & GitHub har använts: ------> CHECK x Projektmappen innehåller en README.md fil: ------> CHECK
Uppgiften lämnas in i tid! Krav för väl godkänt:
x Alla punkter för godkänt är uppfyllda : ------> CHECK x Ett klient-gränssnitt skall byggas för att anropa API:ets alla olika endpoints och presentera datan, redigeringsformulär skall fyllas i med befintlig information. : ------> CHECK x Ytterligare en GET endpoint skall läggas till där det går att hämta ett specifikt objekt: ------> CHECK
HOW TO GET STARTED:
- Clone repository to a folder on your pc.
- Open project inside Visual Studio Code.
- Open terminal and install modules from package.json. To install modules type 'npm install' inside terminal and press enter. If error, go to package.json and see dependencies. Install manually by writig 'npm i (module name here)' for each module.
- Start server by either typing 'nodemon server.js' inside terminal. If error, start the module by clicking the 'run' button found inside: 'EXPLORER > NPM SCRIPTS > {package.json} start nodemon server.js'.
- To testrun the API use 'songs.rest'. Inside, use endpoints to: get data, get specified data, post new data, edit data or delete data.
- To view through frontend either enter http://localhost:3000/songs inside your preferred choice of web browser or open with Live Server (if installed inside VS Code) 'index.html'.
- Navigate endpoints through frontend design.