Coder Social home page Coder Social logo

nc-news-be's Introduction

NORTHCODERS NEWS API

This project provides access to Northcoders news, articles, users and comments.

Getting started

Link below displays all of the available API Endpoints

Prerequisites

This application was built with JavaScript and uses:

  • Node.js - JavaScript run-time environment
  • Express - Web framework
  • mongoose - MongoDB object modelling
  • EJS - Javascript templating language
  • faker.js - Generate data for seed files
  • Lodash - JavaScript utility library
  • Mocha - JavaScript test framework
  • Chai - Node assertion library
  • SuperTest - HTTP assertion library
  • Nodemon - Monitors for changes and automatially restarts server

Installation

You will need to have Node installed before installing other dependencies. Information on how to do this can be found at the Node website.

  1. Download a copy of the project through GitHub:
git clone https://github.com/leon-northcoders/NC-News-BE.git
  1. Download the necessary dependencies:
npm i

Config

Before proceeding, you will need to create a config directory within the root of the project. It is recommended to use a different file for test, production and development node environments, with each exporting the URL location of your MongoDB database.

  1. Create config file for each node environment, exporting the corresponding URL
exports.DB_URL = 'mongodb://localhost:27017/northcoders_news_test'
  1. Create index.js which exports necessary config file depending on node environment
process.env.NODE_ENV = process.env.NODE_ENV || 'dev'
module.exports = require(`./${process.env.NODE_ENV}`)

Running the tests

The test suite is built with the Mocha test framework, including Chai and Supertest.

There are 31 written tests in the spec folder. To execute the test suite:

npm t

Running the app in localhost

  1. To run server locally:
npm run dev
  1. To access your app within a browser or Postman, visit:
http://localhost:9090/
  1. From there you can browse a list of all of the available API endpoints.

Seeding the databases

  1. To seed the development database:
npm run seed:dev
  1. To seed the production database on Mlab:
npm run seed:prod

nc-news-be's People

Contributors

leondelaimy avatar sssam-c avatar leon-northcoders avatar harrietty avatar jdunsby avatar

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.