Giter VIP home page Giter VIP logo

news-api's Introduction

News API (for NewsSpace)

This project was built as part of the backend for the News Space app hosted on Heroku. The RESTful API provides the end-user with an interface to interact with the databases, and retrieve articles, comments, topics and users. Live demo here.

Table of Contents

General Information

The RESTful API, through the various available endpoints, relays information to the end-user from the databases which store data entries about articles, comments, topics, and users. For example, the end-user may retrieve information about a selected article when an article id parameter has been inputted in the endpoint (‘https://news-space.herokuapp.com/api/articles/2’ will retrieve information about the article that has article id = 2). The API also accept queries in the request, such as ‘topic’ and ‘sort_by’. The former filters the retrieved array of articles by the topic referenced, and the latter sorts the retrieved array of articles by valid columns in the relational database for articles.

Technologies Used

  • node.js
  • Express (4.18.1)
  • PostgreSQL (14)

Setup

To run and test the project locally, please follow the instructions below:

  1. Clone the News API repo

    git clone https://github.com/OneInfiniteLoops/News-API.git
  2. Install NPM packages

    npm install
  3. Please note that you will need to access your own environment variables before you can connect to the two local databases. You can do this by creating two .env. files in the parent directory of the repository, .env.test and .env.development. These files are automatically ignored by Git. Once the files are created, set PGDATABASE=<database_name_here> to the corresponding databases respectively. For example, write PGDATABASE=<database_name_test> for the .env.test file.

  4. Run "jest" on the test suites enclosed in app.test.js with the command 'npm test <app.test.js>' in the terminal. The file is located in the "test" directory. Running the test file will automatically seed and use data from the test databases.

Contact

Created by James Yeung [@OneInfiniteLoops].

news-api's People

Contributors

alexander-cox avatar anatdean avatar antariess avatar anthonymedina avatar bainesface avatar dav3rid avatar daviidbartlett avatar dentednerd avatar douglashellowell avatar isabelmaccabee avatar liam310 avatar nc-paul-rogerson avatar nicola-20 avatar oneinfiniteloops avatar p-copley avatar rogersop avatar sssam-c avatar tomosim avatar two-triangles 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.