Giter Site home page Giter Site logo

northcoders_news_be's Introduction

READ ME

NCNEWS Round


About

This repository contains the code for a RESTful API news website, modelled on Reddit.

It was created during my time at Northcoders, for the 'Northcoders News' back-end sprint.

The database was created using PSQL and the subsequent interactions were handled with Knex.

Full TDD was used during the seeding of the database, making use of both Mocha and Chai.

For the endpoints, testing was carried out using SuperTest.


Prerequisites

Node v12.3.1

Npm v6.9.2

Node Postgres v7.11.0

Dev Dependencies:

Knex v0.17.6

PostgreSQL v11

Express v4.17.1

Chai v4.2.0

Chai-sorted v0.2.0

Mocha v6.1.4

Supertest v4.0.2

Nodemon v1.19.1


Set-Up

1. Fork then clone the repository onto your local machine.

2. Install the above dependencies using the npm install command followed by the dependency name.

3. Create a file in the root directory and name this 'knexfile.js'. Copy the following code into the file:

const { DB_URL } = process.env;
const ENV = process.env.NODE_ENV || "development";

const baseConfig = {
  client: "pg",
  migrations: {
    directory: "./db/migrations"
  },
  seeds: {
    directory: "./db/seeds"
  }
};

const customConfigs = {
  production: { connection: `${DB_URL}?ssl=true` },
  development: { connection: { database: "ncnews" } },
  test: { connection: { database: "ncnews_test" } }
};

module.exports = { ...baseConfig, ...customConfigs[ENV] };

Please note: if you are using a Linux system, you will need to include your PostgreSQL username and password within this file.

Don't forget to .gitignore this file if you intend on re-using this repository!

4. To set-up the required databases, run the following commands:

$ npm run setup-dbs

$ npm run seed

Available Endpoints

To view the available endpoints, click on the following link:

https://ncnews-round.herokuapp.com/api


Author

Kate Bryan

northcoders_news_be's People

Contributors

katebry avatar dependabot[bot] avatar kingjabroni avatar

Watchers

 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.