A RESTful API built with Node.js v22.5.1, Express, and PostgreSQL v14.12 for a community news site, similar to Reddit. The API enables users to engage with articles, comments, topics, and users by performing CRUD operations. Testing is handled with Jest and Supertest.
Deployed website here Fair warning, having used free services means it might take some time to load
- GET /api: Provides full API documentation in JSON
- Database:
- Fully relational with PostgreSQL
- Seeded test and development dbs for testing and local development
- GET /api
Returns a list of all available endpoints
- GET /api/topics
Fetch all topics
-
GET /api/articles
Fetch all articles- Supports optional queries:
sort_by
(e.g., created_at, votes)order
(ASC/DESC)topic
(filter by topic)
- Supports optional queries:
-
GET /api/articles/:article_id
Fetch a single article by ID -
GET /api/articles/:article_id/comments
Fetch comments for a specific article -
POST /api/articles/:article_id/comments
Add a comment to a specific article -
PATCH /api/articles/:article_id
Update an article (e.g. votes)
- PATCH /api/comments/:comment_id
Update a comment (e.g. votes) - DELETE /api/comments/:comment_id
Delete a specific comment
-
GET /api/users
Fetch all users -
GET /api/users/:username
Fetch a single user by username
npm install
Create your own .env
files for development and test environments:
.env.development
:PGDATABASE=YOUR_DEV_DB
.env.test
:PGDATABASE=YOUR_TEST_DB
npm run seed
npm test app
This portfolio project was created as part of a Digital Skills Bootcamp in Software Engineering provided by Northcoders