This project allows you to run a JSON API for an album database.
After cloning the repo, you need to use composer install
to download and install the dependencies. If you do not have composer, you can get it here.
You need a PostgreSQL database, if you already have one, you can put your credentials in the .env
file in the DB_...
section. If you do not have one, you can use docker-compose up
in the root directory to run a docker container with the docker-compose.yml
file included. More information on docker here.
Serve public/index.php
with whichever HTTP server you prefer (it must support php obviously). If you do not have any server set up, you can use php artisan serve
from the root of the repository and the project will be served locally.
Register via the webpage (yourdomain/register
), you can now interact with the api at yourdomain/api/albums
A dictionary containing the following keys:
id: The identifier of the album as an integer.
name: The name of the album.
artist: The name of the artist.
image: A url pointing to the album's cover.
genre: The album's muscical genre.
year: The album's year of production.
label: The album's label.
songs: A list of comma-separated songs as a string.
rating: The album's rating as an integer, out of 5.
Returns the first 10 albums.
Optional query parameter returns only albums where any of the strings match the query.
Optional offset parameter returns the 10 albums after the offset, useful for pagination.
Returns an album by id.
Only takes JSON as input.
Creates a new album.
Returns the newly created album object, including its id.
Only takes JSON as input.
Updates the specified album.
Deletes the specified album.
The project is ready to deploy on heroku, just push this repo to your herokuapp repo.