A RESTful API for a news application built with Express.js and PostgreSQL. This project serves as the backend for the NC News frontend and provides endpoints to fetch, create, update, and delete articles, comments, users, and topics.
- Node.js
- Express.js
- PostgreSQL
- pg (node-postgres)
- Jest & Supertest (for testing)
- Retrieve all articles with comment counts
- Filter articles by topic
- Sort articles by date, topic, or comment count
- Post and delete comments
- API-level error handling with meaningful status codes
Follow these steps to run the project locally:
git clone https://github.com/Yan2992/be-nc-news.git cd be-nc-news
npm install
Create two .env files in the root directory:
.env.development
.env.test
Each should contain the appropriate PostgreSQL connection string:
DATABASE_URL=postgres://<your_username>:<your_password>@localhost:5432/nc_news
For testing: DATABASE_URL=postgres://<your_username>:<your_password>@localhost:5432/nc_news_test
🔐 Replace <your_username> and <your_password> with your actual PostgreSQL credentials.
npm run setup-dbs
npm run seed
npm run dev
npm test
🔗 Related Repositories Frontend Repo – fe-nc-news -> https://github.com/Yan2992/be-nc-news
👤 Author GitHub – @Yan2992
LinkedIn – Yan Bulavintsev
This portfolio project was created as part of a Digital Skills Bootcamp in Software Engineering provided by Northcoders