-
Backend API built using Express, Node.js, PostgreSQL and DotEnv.
-
Tested with Jest and Supertest.
-
Provides multiple endpoints for retrieving, sorting and filtering data queries
-
Full list of endpoints available in
endpoints.json
, located in root directory -
Live Version: Hosted on Render
-
Repository: GitHub
1. Clone the Repo
-
Clone the repository:
git clone https://github.com/lawaffy/nc-news-proj.git
-
Change directory into the repository:
cd nc-news-proj
2. Check Requirements
- Dependency and Version Requirements:
- node.js: v23.3.0,
- PostgresSQL: v17.2,
- Express: v4.21.2,
- pg-format: v1.0.4,
- pg (node postgres): v8.7.3,
- dotenv: v16.0.0,
package.json
includes all requirements and scripts
3. Install Dependencies
run npm install
to locally install dependencies
4. Set Up and Seed the Database
-
Scripts:
- Set up db:
npm run setup-dbs
- creates development and test databases - Seed db:
npm run seed
- seeds the development database - Tests:
npm run test
- runs Jest test suites
- Set up db:
5. Setting Up Environment Variables
- Next, you will need to create two
DotEnv
files to connect to the databases locally. Check thesetup.sql
file for the database name!
.env.test
which contains:PGDATABASE=database_name_test
.env.development
which contains:PGDATABASE=database_name