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.
NOTE: All requests and responses are in JSON format.
- Express.JS
- JavaScript
- PostgreSQL
- 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
-
Install Insomnia which will allow you to make the requests to the various endpoints.
-
Open up your terminal and run
git clone https://github.com/mandeep-s1ngh/Shopping-List-API.git
to clone the repo. -
Move the folder to your usual directory for projects (if necessary).
-
Open up the folder in your code editor of choice and run
npm install
in it's integrated terminal to install all the dependencies. -
Then run
psql -f db.sql
to setup the database and table followed bynpm run dev
to start the app. The app will continue to run in the background and you can then test the endpoints via Insomnia.