Giter Site home page Giter Site logo

news-api-project's Introduction

Welcome to NC News Api ๐Ÿ‘‹

This is a mock News Api that was made a a back-end project as part of the Northcoders Bootcamp. It can be found here.
For this project I learnt how to make use of Express, Postgres and Knex to create a funtional API with multiple endpoints listed below:

GET /api

GET /api/topics

GET /api/articles

GET /api/articles/:article_id
PATCH /api/articles/:article_id

GET /api/articles/:article_id/comments
POST /api/articles/:article_id/comments

GET /api/users/:username

PATCH /api/comments/:comment_id
DELETE /api/comments/:comment_id

Roadmap

While this is a funtional API my plans to add more endpoints are on hold until I complete the course after which I will hopefully have the time to add some more.
These will include:

GET /api/articles (with queries/pagination)
GET /api/articles/:article_id/comments(with queries/pagination)
DELETE /api/articles/:article_id
POST /api/topics
POST /api/users
GET /api/users

For Developers

Minimum version requirements

Node.js: v15.6.0

Postgres: v8.5.1


Install

Fork my project the clone to your local machine e.g:

git clone https://github.com/DCrawley94/be-nc-news.git

Install all dependencies using a package manager e.g:

npm install

Additionally this project requires the creation of your own knexfile.js which should look like this:

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',
      username: '*YOUR PSQL USERNAME HERE*',
      password: '*YOUR PSQL PASSWORD HERE*',
    },
  },
  test: {
    connection: {
      database: 'nc_news_test',
      username: '*YOUR PSQL USERNAME HERE*',
      password: '*YOUR PSQL USERNAME HERE*',
    },
  },
};

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

More information on creating your version can be found here.


To seed the database simply run the seeding script using your package manager e.g:

npm run seed

Run tests

There is a test suite written that tests all current endpoints and error handling as well as several utility functions used in the seeding process.

npm run test

Author

๐Ÿ‘ค Duncan Crawley

news-api-project's People

Contributors

anthonymedina avatar nc-paul-rogerson avatar daviidbartlett avatar anatdean avatar p-copley avatar alexander-cox avatar sssam-c avatar dcrawley94 avatar scottoster avatar tomosim avatar antariess avatar nicola-20 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.