A JavaScript back-end API project which aims to mimic a real-world backend service (e.g. Reddit).
Website: https://nc-news-th0a.onrender.com
The front-end app for this project can be found here:
https://github.com/pigeonwatcher/NC-News-FE
- postgreSQL(v14.10)
- Node.js(v21.2.0)
Once Node.js is installed, install the following packages:
-
dotenv:
npm install dotenv -
express:
npm install express -
node-postgres:
npm install pg -
pg-format:
npm install pg-format
Create a '.env.development' and '.env.test' and file then add the following:
PGDATABASE=nc_news
PGDATABASE=nc_news_test
Run npm run setup-dbs to create a 'nc_news_test' and 'nc_news' database.
You can then run npm run seed to seed the development database.
The following packages were used to test the API:
-
jest:
npm install -D jest -
jest-sorted:
npm install -D jest-sorted -
supertest:
npm install -D supertest
Run npm run test to run the tests which will automatically use the test database in '.env.test'.
A detailed explanation of each endpoint can be found in the endpoints.json.
Nevertheless, some key endpoints are...
- /api
- /api/topics
- /api/articles
- /api/comments
- /api/users
Massive thanks to my mentors Pippa, John and Rich at Northcoders for their valuable feedback throughout this project! :)