Giter VIP home page Giter VIP logo

nc-news-be's Introduction

NC News Backend

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.

Getting Started

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.

Prerequisites

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:

Installing

After verifying you have both Node.js and MongoDB installed you can install a local version by completing the following steps:

  1. Open a terminal instance
  2. Clone this repository from GitHub by running git clone https://github.com/adieCodes/nc-news-be.git in the terminal
  3. Add dependencies by typing npm install in the terminal
  4. Run an instance of the database using the command mongod, this will keep running in that terminal window
  5. 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.
  6. You can then run the application using npm run dev

Running the tests

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.

What's tested?

Each of the applications endpoints, with both successful and unsuccessful requests (where applicable).

Routes

  • GET /api/topics - Return all topics
  • GET /api/topics/:topic/articles - Return all articles for a particular topic ID
  • GET /api/articles - Return all articles
  • GET /api/articles/:article_id/ - Return an individual article by its ID
  • GET /api/articles/:article_id/comments - Return all comments for a single article ID
  • POST /api/articles/:article_id/comments - Add a new comment to the appropriate article ID
  • PUT /api/articles/:article_id - Increment/decrement votes on an article
  • PUT /api/comments/:comment_id - Increment/decrement votes on a comment
  • DELETE /api/comments/:comment_id - Delete a comment
  • GET /api/users - Return all user profiles
  • GET /api/users/:username - Return a user profile along with their articles and comments

Build steps

Build steps are included to ensure:

  1. code meets Airbnb's JavaScript style guide
  2. tests are passed before code is committed to git

Built With

Worth noting

The config file has been commited to allow local deployment and testing, under usual circumstances this would have been added to the gitignore.

Acknowledgments

Everyone at Northcoders for their outstanding curriculum and support. They gave me the knowledge and confidence to build a career in Software Development.

nc-news-be's People

Contributors

adiecodes avatar

Watchers

James Cloos avatar

nc-news-be's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.