Northcoders News is a social news aggregation, web content rating, and discussion website. It is similar to Reddit
Northcoders News has articles which are divided into topics. Each article has user curated ratings and can be up or down voted using the API. Users can also add comments about an article. Comments can also be up or down voted. A user can add comments and remove any comments which they have added.
I have used Node.js, Express and MongoDB to build this application which will store article, comment and user data and their relationships. Serving this information via RESTful endpoints. The frontend for this application consumes this data, which you can view here.
I have followed TDD (Test Driven Development) best practises when building this application. If you would like to see the tests in action or run the application locally instructions to do so are below.
If you would prefer you can view a deployed version here.
This application uses Node v8.9.4 (Stable) and MongoDB v3.4.4. To verify you have each installed you will need to open a terminal window and run the following commands
$ which node
$ which mongod
If either/both command does not return a file path you will need to follow the appropriate instructions below:
After verifying you have both Node.js and MongoDB installed you can install a local version by completing the following steps:
- Open a terminal instance
- Clone this repository from GitHub by running
git clone https://github.com/adieCodes/nc-news-be.git
in the terminal - Add dependencies by typing
npm install
in the terminal - Run an instance of the database using the command
mongod
, this will keep running in that terminal window - Start a new terminal window and enter
npm run seed:dev
to add data to the database. This may take a few minutes as there's a fair amount of data. When the process is complete the console will display 'Database seeded' and the node process will terminate. - You can then run the application using
npm run dev
To run the tests you will need to open a new terminal instance and run npm test
. You will see the result of each test along with a brief explanation of the test.
Each of the applications endpoints, with both successful and unsuccessful requests (where applicable).
GET /api/topics
- Return all topicsGET /api/topics/:topic/articles
- Return all articles for a particular topic IDGET /api/articles
- Return all articlesGET /api/articles/:article_id/
- Return an individual article by its IDGET /api/articles/:article_id/comments
- Return all comments for a single article IDPOST /api/articles/:article_id/comments
- Add a new comment to the appropriate article IDPUT /api/articles/:article_id
- Increment/decrement votes on an articlePUT /api/comments/:comment_id
- Increment/decrement votes on a commentDELETE /api/comments/:comment_id
- Delete a commentGET /api/users
- Return all user profilesGET /api/users/:username
- Return a user profile along with their articles and comments
Build steps are included to ensure:
- code meets Airbnb's JavaScript style guide
- tests are passed before code is committed to git
- NodeJS - JavaScript runtime
- MongoDB - NoSQL database
- Mongoose - Object Data Modeling (ODM) for mongo
- Express - Web Application Framework
The config
file has been commited to allow local deployment and testing, under usual circumstances this would have been added to the gitignore
.
Everyone at Northcoders for their outstanding curriculum and support. They gave me the knowledge and confidence to build a career in Software Development.