Skip to content

UpEight/be-nc-news

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Northcoders News API

A RESTful API for accessing the Northcoders News backend data.

The available endpoints are shown here.

Background

The data is stored in a PSQL database. The database Interactions are carried out using Knex.

Installing a local development instance

Prerequisites

Requires a local running PSQL instance.

Installation

  1. Clone this repo:
git clone https://github.com/UpEight/be-nc-news

cd be-nc-news
  1. Install the dependencies:
npm install
  1. Create the following knexfile.js in your root directory:
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 customConfig = {
  development: {
    connection: {
      database: 'nc_news'
      user : 'your_database_user',
      password : 'your_database_password',
    }
  },
  test: {
    connection: {
      database: 'nc_news_test'
      user : 'your_database_user',
      password : 'your_database_password',
    }
  },
  production: {
    connection: `${DB_URL}?ssl=true`
  }
};

module.exports = { ...customConfig[ENV], ...baseConfig };
  1. Create the test and development databases:
npm run setup-dbs
  1. Seed the databases:
npm run seed        // seeds the development db
npm run seed-test   // seeds the test db
  1. Start your local server:
npm start

Running the tests

Run the unit tests:

npm test

Run the utility function tests:

npm run test-utils

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published