Welcome to NC News! This is a platform where you can read, share, and discuss articles on various topics. Whether you're interested in technology, politics, or lifestyle, NC News has got you covered.
You can access the hosted version of NC News here.
NC News is a web application that provides endpoints to interact with articles, comments, users, and topics. Here's a summary of the main functionalities:
-
Get Topics:
- Endpoint:
GET /api/topics
- Description: Retrieves a list of available topics.
- Endpoint:
-
Get Endpoints:
- Endpoint:
GET /api
- Description: Retrieves a list of all available endpoints.
- Endpoint:
-
Get Article by ID:
- Endpoint:
GET /api/articles/:article_id
- Description: Retrieves a single article by its ID.
- Endpoint:
-
Get Articles:
- Endpoint:
GET /api/articles
- Description: Retrieves a list of articles.
- Endpoint:
-
Get Comments by Article ID:
- Endpoint:
GET /api/articles/:article_id/comments
- Description: Retrieves comments associated with a specific article.
- Endpoint:
-
Add Comment:
- Endpoint:
POST /api/articles/:article_id/comments
- Description: Posts a comment on a specific article.
- Endpoint:
-
Update Article:
- Endpoint:
PATCH /api/articles/:article_id
- Description: Updates an existing article.
- Endpoint:
-
Delete Comment:
- Endpoint:
DELETE /api/comments/:comment_id
- Description: Deletes a comment.
- Endpoint:
-
Get Users:
- Endpoint:
GET /api/users
- Description: Retrieves a list of users.
- Endpoint:
-
Filter and Sort Articles:
- Endpoint:
GET /api/articles (queries)
- Description: Allows articles to be filtered and sorted.
- Endpoint:
-
Get Comment Count:
- Endpoint:
GET /api/articles/:article_id (comment count)
- Description: Adds a comment count to the response when retrieving a single article.
- Endpoint:
To get started with NC News locally, follow these steps:
Make sure you have the following installed:
- Node.js (minimum version v-21)
- PostgreSQL (minimum version 14.10)
git clone https://github.com/koalaphant/nc-news.git
cd nc-news
npm install
To install the dependencies required for the project, run the following command in your terminal:
npm install dotenv@^16.0.0 express@^4.18.2 pg@^8.7.3
npm install --save-dev jest@^27.5.1 jest-extended@^2.0.0 jest-sorted@^1.0.15 pg-format@^1.0.4 supertest@^6.3.4
- dotenv: ^16.0.0
- express: ^4.18.2
- pg: ^8.7.3
- jest: ^27.5.1
- jest-extended: ^2.0.0
- jest-sorted: ^1.0.15
- pg-format: ^1.0.4
- supertest: ^6.3.4
When cloning this repository, developers will need to add necessary environment variables.
To accomplish this, follow these steps:
Create two files:
.env.development
.env.test
Within these files, include key information required to connect to the two databases locally.
Here's an example format:
PGDATABASE=your_database_name_here
Replace your_database_name_here
with the name of your local database. These files should also contain any other sensitive information required for the application to run locally.
npm run seed
npm test
- Node.js: v-21
- PostgreSQL: 14.10
- Andrew Ward-Jones
Feel free to explore, contribute, and provide feedback! If you encounter any issues or have suggestions for improvement, please raise them in the Issues section. Enjoy reading and discussing articles on NC News!