the news den api

I completed this project as part of the back-end section of the Northcoders Developer Pathway. It is a RESTful API that will serve as the back-end for my The News Den website, a social news aggregation similar to Reddit.

The News Den API

The following endpoints are available on the API:

  • GET /api: serves a JSON representation of all the available endpoints of the API.
  • GET /api/articles: serves an array of all articles.
  • GET /api/topics: serves an array of all topics.
  • GET /api/users/:username: serves a user object.
  • GET /api/articles/:article_id: serves an article object.
  • PATCH /api/articles/:article_id: accepts an object in the form { inc_votes: newVote } and serves an article object with the updated number of votes.
  • POST /api/articles/:article_id/comments: accepts a comment object in the form { username: username, body: body }, adds the comment to the given article_id and serves the posted comment.
  • GET /api/articles/:article_id/comments: serves an array of comments for the given article_id.
  • PATCH /api/comments/:comment_id: accepts an object in the form { inc_votes: newVote }, updates the votes on a comment and serves the updated comment.
  • DELETE /api/comments/:comment_id: deletes the comment by the given comment_id.

The API was built using full TDD methodologies, with the following technologies:

  • JavaScript/Node.js
  • Express - Web framework
  • PostgreSQL - Database
  • Knex - Migrations and query building
  • Heroku - Hosting

I tested the endpoints with:

  • Jest
  • Jest Sorted
  • Supertest