Northcoders News is a social news aggregation, web content rating and discussion website similar to Reddit.
The articles that make up this site are divided into topics: Football, Cooking and Coding.
-
Each article has user curated ratings and can be up or down voted using the arrows.
-
Users can add comments about an article and those comments can be up or down voted.
-
A user can also add comments and remove comments, but only their own. If you try to delete another user's comment you will be denied access!
Route | |
---|---|
GET /api/topics |
Get all the topics |
GET /api/topics/:topic_id/articles |
Return all the articles for a certain topic |
GET /api/articles |
Returns all the articles |
GET /api/articles/:article_id/comments |
Get all the comments for a individual article |
POST /api/articles/:article_id/comments |
Add a new comment to an article. This route requires a JSON body with a comment key and value pair e.g: {"comment": "This is my new comment"} |
PUT /api/articles/:article_id |
Increment or Decrement the votes of an article by one. This route requires a vote query of 'up' or 'down' e.g: /api/articles/:article_id?vote=up |
PUT /api/comments/:comment_id |
Increment or Decrement the votes of a comment by one. This route requires a vote query of 'up' or 'down' e.g: /api/comments/:comment_id?vote=down |
DELETE /api/comments/:comment_id |
Deletes a comment |
GET /api/users/:username |
Returns a JSON object with the profile data for the specified user. |
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
To install this programme you will first need a commandline terminal such as iTerm2 (for Mac) or Terminator (Linux/Unbuntu/Fedora) - or something similar. For more info on using the commandline see this blog article
You will then need to install the following:
- Node.js
- NPM
Check if Node.js is already installed by typing the following into the commandline (without the dollar sign):
$ node -v
To install Node.js follow these instructions
Check if NPM is installed:
$ npm -v
To install NPM follow these instructions
(Northcoders News consists of two aptly named parts:
-
"Northcoders-News-Back-End" - a backend REST API
-
"Northcoders-News-Front-End" - a frontend user interface
To get these up and running you will need to clone both repositories onto your machine. Then you will need to keep three shells running in your terminal to run the backend database and server, and also the frontend server. Follow the instructions below:
Clone both repos
- Click the green button towards the top right of the page
- Click the "Copy to clipboard" button
- On your machine navigate to your chosen folder using the commandline and paste in the link you just copied from the repo at the end of the following command:
$ git clone
eg.
$ git clone https://github.com/ashcode1/Northcoders-News-API"
Install dependencies
In each directory run the following command:
$ npm install
Run the servers
Open two shells in the new backend directory and type the following:
- 1st shell (database):
$ mongod
- 2nd shell (backend server running on port 3000):
$ npm start
Open a shell in the frontend directory:
- 3rd shell (frontend server also port 3000 but will suggest the next available port such as 3001 because the back end is already on 3000 - just type "y" and hit "enter" to confirm the switch)
$ npm start
~ "Would you like to run the app on another port instead? (Y/n)"
$ y
If it doesn't open automatically, open a new tab in your browser at the appropriate URL. eg.
$ http://localhost:3001/
You should now be able to see the homescreen in the browser.
Open a new shell in the frontend directory and run the following command:
$ npm test
- Ashley Hopkins - github
This project is licensed under the MIT License
- The Northcoders team for setting the challenge of this project and for creating and supporting an amazing network of developers in the north