Skip to content

This is a restful API built with Express and PostgreSQL. The API manages a shopping list database.

Notifications You must be signed in to change notification settings

mandeep-s1ngh/Shopping-List-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopping List API

Summary

This is a RESTful API built with Express and PostgreSQL, using the node-postgres library to interact with the PostgreSQL database. The app runs on localhost port 3000.

The purpose of this API is to provide endpoints for managing a shopping list database which gives the ability to add new items, retrieve all items, retrieve a single item by ID, and delete an item. Error handling middleware has also been setup to provide the appropriate error codes and messages.

I also wanted to solidify my understanding of RESTful API's, Express, PostgreSQL having learnt them whilst enrolled on the NorthCoders Software Engineering bootcamp.


Endpoints & Screenshots

NOTE: All requests and responses are in JSON format.

POST localhost:3000/api/new-item

POST new item

GET locahost:3000/api/all-items

GET all items

GET localhost:3000/api/item/:item_id

GET single item

DELETE localhost:3000/api/remove-item/:item_id

DELETE single item


Tech Stack

  • Express.JS
  • JavaScript
  • PostgreSQL

Local Setup

  1. Install postgres.app which will allow you to be able to access the PostgreSQL command line interface and create the database.

NOTE: If you are on Windows OS, you can use postgreSQL

  1. Install Insomnia which will allow you to make the requests to the various endpoints.

  2. Open up your terminal and run git clone https://github.com/mandeep-s1ngh/Shopping-List-API.git to clone the repo.

  3. Move the folder to your usual directory for projects (if necessary).

  4. Open up the folder in your code editor of choice and run npm install in it's integrated terminal to install all the dependencies.

  5. Then run psql -f db.sql to setup the database and table followed by npm run dev to start the app. The app will continue to run in the background and you can then test the endpoints via Insomnia.

About

This is a restful API built with Express and PostgreSQL. The API manages a shopping list database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published