Skip to content

The API provides access to a variety of news articles, allows for comments to be posted, and even lets you filter news by specific topics. It’s built using Node.js and Express and uses PostgreSQL for storing data.

Notifications You must be signed in to change notification settings

RGBlife/news-api

Repository files navigation

Article Hub API 🗞️

Overview

Welcome to the Article Hub API! It’s a simple and easy-to-use service for accessing news articles and related data. It’s hosted online here for anyone to use. (Please allow 1-2 minutes for the server to wake up)

This project is part of my portfolio whilst enrolled on the Northcoders Software Development Bootcamp.

What’s Inside?

The API provides access to a variety of news articles, allows for comments to be posted, and even lets you filter news by specific topics. It’s built using Node.js and Express and uses PostgreSQL for storing data and tested using Jest using the Test-Driven Development approach.

Tech Stack

  • Node.js
  • Express
  • PostgreSQL
  • Jest & Supertest

Table of contents

Getting Started

What You'll Need

How to Get It Running

  1. Clone the Project:

    git clone https://github.com/RGBlife/news-api.git
    cd news-api
    
  2. Install Dependencies:

    npm install
    
  3. Set up your Environments:

    You will need to add the following environment variables to connect to the databases if you wish to clone the project and run it locally.

    You’ll need to create two .env files: one for development (.env.development) and one for testing (.env.test). These should contain the variables needed for database connections.

    Example files:

    .env.development file

    PGDATABASE=nc_news
    

    .env.test file

    PGDATABASE=nc_news_test
    

    .env.production file (if you are hosting the api)

    DATABASE_URL=your_database_url
    PORT=your_chosen_port
    
  4. Setup the database and Populate:

    npm run setup-dbs
    npm run seed
    
  5. Run the Tests: Execute the test with the following command:

    npm test
    

Additional Information

Check out what API endpoints are available and how to use them by going to API Info (I recommend installing the popular JDON viewer chrome extension that will display the JSON data in a more readable format.

The API has been created using the MVC design pattern and the database is stored on ElephantSQL and hosted using Render.

About

The API provides access to a variety of news articles, allows for comments to be posted, and even lets you filter news by specific topics. It’s built using Node.js and Express and uses PostgreSQL for storing data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 23