I built the backend service for a social media news service similar to reddit, where a user can post articles relating to a topic. Other users can comment and leave votes too. This backend is built using Node.js, Express.js and PostgresSQL. Test Driven Development managed by using Jest and Supertest.
-
Fork and clone this repo
https://github.com/AudeNgD/nc-news
-
In your local repo, install the dependencies by running
npm i
-
Create a .env.test and .env.development files in the root folder of your local repo. In the .env.test file, add
PGDATABASE=nc_news_test
In the .env.development file, addPGDATABASE=nc_news
NB - The db names should match the names listed in the /db/setup.sql file -
Check that the .env files are .gitignored
-
Seed the local databases by running
run setup-dbs
andrun seed
. The latter will seed the db with the development data. -
Run the tests by running
npm test app
to check that all is in order.
- PostgreSQL > 14.11
- Node.js > 21.3.0