https://board-games-review-be.onrender.com/api
This app is a RESTFUL API that allows users to interact with a relational database of board game reviews, review comments, board game categories and users. Accessing the ‘/api’ endpoint will present users with a JSON file containing information about all the available endpoints for the app, including instructions on how to present requests for PATCH and POST requests.
In order to access this repo locally, you can either fork and clone this repo, or clone directly from the following url:
https://github.com/callumu21/Board-Games.git
You can install all dependencies by running:
npm install
OR:
npm i
The dependencies used in this project are:
- dotenv: used for loading environment variables from .env files,
- express: used for creating your HTTP server,
- node-postgres: PostgreSQL client for Node.js,
- pg-format: used for seeding the database with dynamic SQL queries,
The developer dependencies used in this project are:
- husky: used for managing Git hooks,
- jest: testing suite for JavaScript,
- jest-extended: allows additional assertions in jest test suites,
- jest-sorted: used for verifying results are returned in a set order,
- supertest: used for testing HTTP assertions,
in the package.json
file you'll see scripts for creating and seeding your database(s):
"setup-dbs": "psql -f ./db/setup.sql"
"seed": "node ./db/seeds/run-seed.js"
You can run these script by using npm run:
npm run setup-dbs
npm run seed
This repo comes with some test suites already built in, and npm install should have provided you with any required testing packages. In order to run an individual test file, you simply need to enter the following command into your terminal:
npm test your-file-name
Alternatively, a shorthand version is:
npm t your-file-name
If you wish to run all of the test suites at once, you can use the following command:
npm t
In order to access the correct databases, you'll first need to set up your environment variables.
Start by creating a .env.test file and a .env.development file.
In the .env.test file, specify that you wish to connect to the testing database by inserting the following on line 1:
PGDATABASE = nc_games_test
In the .env.development file, make sure to add the development database name as follows on line 1:
PGDATASE = nc_games
.env files are automatically excluded in the .gitignore file included within this repo.
This app was made on Node Version:
node -v | v18.5.0
Postgres Version:
psql -V | 14.4