Skip to content

A back-end project created to demonstrate the creation of a RESTful API where users can view and interact with information relating to users, articles, comments and topics.

Notifications You must be signed in to change notification settings

jjcrl/nc_news-backend

Repository files navigation

Nc News Back End.

This project is a demonstration of a RESTful API written in JavaScript and using Express JS alongside PostgreSQL as a database.

This API is used as the Back End of my Front End project: https://github.com/jjcrl/fe-nc-news

Available Data Interactions

  • GET All available endpoints

  • GET An article by its id

  • GET All articles , with the abilitly to filter by topic, and sort by various feilds and decide the order

  • GET All users

  • GET A single user

  • GET All Topics

  • GET Comments for a given article

  • POST Publish a new article

  • POST Comment on an article

  • POST Create a new topic

  • PATCH Vote on a comment

  • PATCH Vote on an article

  • DELETE Your own article

  • DELETE Your own comment

How to clone and set up this repository

Step 1: Meet Minimum Requirements

  • Node.js (v16.13.1)
  • PostgreSQL (v2.5.2)

Step 2: Clone this GitHub repository

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

Step 3: Install dependencies

Install JS dependencies by running 'npm i' within the cloned repository

You must also have PostgreSQL installed and running for following steps to succeed

Step 4: Add configuration files

Create '.env.test' and '.env.development' files containing 'PGDATABASE=nc_news_test' and 'PGDATABASE=nc_news' respectively, in the root directory of this repository

Step 5: Run setup scripts

  • Run 'npm run setup-dbs' to create the databases in PostgreSQL
  • Run 'npm run seed' to seed the created databases

Step 6: Run tests OR Experiment with API locally

At this stage, you're able to run tests with 'npm run test'

You can also test the API manually by running 'npm run start' and making requests to localhost:[port] to whichever endpoints you wish to test

About

A back-end project created to demonstrate the creation of a RESTful API where users can view and interact with information relating to users, articles, comments and topics.

Topics

Resources

Stars

Watchers

Forks