Skip to content

Magdyz/news-project-backend

Repository files navigation

PROJECT NC News API

JavaScript Node.js PostgreSQL

Link To API:

PROJECT NC News API

API Endpoints:

Endpoints Overview:

  • GET /api: responds with a list of available endpoints.
  • GET /api/topics: responds with a list of topics.
  • GET /api/articles/: article_id: responds with a single article by article_id.
  • GET /api/articles: responds with a list of articles.
  • GET /api/articles/:article_id/comments: responds with a list of comments by article_id.
  • POST /api/articles/:article_id/comments: add a comment by article_id.
  • PATCH /api/articles/:article_id: updates an article by article_id.
  • DELETE /api/comments/:comment_id: deletes a comment by comment_id.
  • GET /api/users: responds with a list of users.
  • GET /api/articles (queries): allows articles to be filtered and sorted.
  • GET /api/articles/:article_id (comment count): adds a comment count to the response when retrieving a single article.

About the project

The NC News Project is a backend Node.js Express application with a PostgreSQL database, designed to provide programmatic access to application data. Modeled after real-world backend services like Reddit, the project aims to mimic their functionality, offering essential information to frontend architectures.

Installation Instructions:

Clone the Repository

git clone https://github.com/Magdyz/project-nc-news.git

Install Dependencies:

cd nc-news-project
npm install

Seed the Local Database:

npm run seed

This will seed the local PostgreSQL database with sample data. Make sure you have PostgreSQL installed and running locally. This will create an initial set of data that you can use to test out the functionality of the application. It also allows you to see how the data is structured.

Run Tests:

npm run test

This command will execute all the tests in the project to ensure everything is working correctly.

Setting up Environments:

  • Inside the root directory, create two new files named .env.development and .env.test. These files will hold your environment variables for development and testing respectively.
  • Populate each with your environment variables.
  • You can use the example provided in .env.example as a starting point.

PGDATABASE = <YOUR_DB_NAME>

About

A backend Node.js Express application with a PostgreSQL database, designed to provide programmatic access to application data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published