We will be building an API for the purpose of accessing application data programmatically. The intention here is to mimic the building of a real world backend service (such as reddit) which should provide this information to the front end architecture.
$ git clone https://github.com/scarlettk64/nc_games.git
$ npm install
To set-up this repo and run this locally, you will need to create two enviroment files.
- An '.env.development' file with:
PGDATABASE = nc_games
- An '.env.test' file with:
PGDATABASE = nc_games_test
The database needs to be seeded and this is achieved by running
$ npm run setup-dbs
This endpoint gets a JSON object with all of the endpoints avalible to make.
This endpoint gets an array of category objects with a slug and description property.
This endpoint gets an array of review objects with review_id, title, designer, owner, review_img_url, category, created at, votes, and comment count.
Queries that can be made:
- ?category= - this will filter the array by category given.
- ?sort_by= - this will sort the array by a given property of the review objects.
- ?order= - this will sort the array by ascending (asc) or descending (desc).
By default the array returned will be sort by created_at in descending order.
This endpoint will get a review object with properties of review_id, title, designer, owner, review_img_url, category, created at, votes, and comment count, when given a specified review id.
This endpoint will return an array of comment object that have the specified review id.
This endpoint will return an array of user objects with the properties of username, name, and avatar_url.
This endpoint will add a comment to the comments array and given a pre-specified review id and will return a comment object with comment id, body, review id, author, votes, and created at.
This enpoint will take an object with a property of inc_vote and will update the votes of the review with the review id specified.
This endpoint will delete a comment
The project was created using:
- node --version | v10.19.0
- psql --version | v12.12
This can be accessed at: