This is the backend project of my Northcoders Software Development Bootcamp.
It is a backend Reddit-clone client, serving data via a variety of API endpoints.
For a summary of available endpoints and data provided, please visit the hosted version of this app at https://reddit-backend-client.onrender.com/api
-
Clone the repo to your local machine
-
Run
npm install
to install all required dependencies.- Minimum versions required:
- Node - v20.5.0
- PostgreSQL - v15
- Minimum versions required:
-
This repo requires you to set up your own database connections as these will be specific to you. This assumes that you have PSQL installed locally on your machine.
-
As the repo uses both
dev
andtest
environments, you will need to set up separate databases for each of these, using the following steps:- create a file in the root of the repo named
.env.test
and place the following code inside the file:
PGDATABASE=nc_news_test
- create a second file in the root of the repo named
.env.development
and place the following code inside the file:
PGDATABASE=nc_news
- Make sure to save both files.
- create a file in the root of the repo named
-
-
Run
npm run setup-dbs
-
if creating a production environment using a hosted DB such as ElephantSQL, you will need to create a
.env.production
file in the root of the project. - Paste the following into the file, replace the URL with your ownDATABASE_URL=postgres://YOUR_URL_GOES_HERE
-
Run
npm run seed
to seed the test DB, and/or runnpm run seed-prod
to seed the production DB. -
To run all provided tests, run
npm test