A backend for an eCommerce application. Allows users to manipulate a database of products, categories, and tags. Demonstrates use of the Sequelize package for basic CRUD functionality with a SQL database. Can be accessed and interacted with via an API client such as Postman or Insomnia.
-
Clone this repo. Install dependencies by running
npm install
. -
Create a local database called
ecommerce_db
by running theschema.sql
file from the MySQL shell. -
Exit the database and seed it with some starter data by running
npm run seed
-
Create a
.env
file in the root directory with the following variables:
DB_NAME=ecommerce_db
DB_USER=[your SQL username]
DB_PW=[your SQL password]
-
Run
npm start
to start the program. -
Submit requests to any of the endpoints using an API client.
- id is optional (will return all products by default)
- GET, POST, UPDATE, DELETE
- GET returns products and associated categories and tags
Example response from GET:
Example request object for POST, PUT:
- Not all properties required for PUT
- id is optional
- GET, POST, UPDATE, DELETE
- GET returns categories and associated products
- id is optional
- GET, POST, UPDATE, DELETE
- GET returns tags and associated products