This is a node application that utilizes Sequelize (MySQL specifically) and Express to make a backend for an e-commerce website. Currently there is no front end views, but all the respective routes have been set up. A demonstration of setting up the database, and using the routes can be found here.
- Models for Categories, Products and Tags, as well as their associated relations.
- Routes for GET, POST, PUT, and DELETE requests for all the models.
- Seed data script to seed the database with some test data.
- Secure db, username and password files through enviroment variables.
- Make sure you have Node JS installed on your machine.
- Clone or download the repository.
- Navigate to the repository folder on your local machine in the command line and run:
npm install
- After all the dependencies are installed, create an .env file in the root directory, and set it up like so:
DB_USER=yourUsernameHere
DB_PW=yourPasswordHere
DB_NAME=ecommerce_db // This MUST be ecommerce_db for this app to work.
- In the
/db
folder, there is a schema.sql file that you can run in MySQL workbench (or equivalent) to set up the initial database:
- Back in the command line, run the following to seed the database:
npm run seed
- Finally, to start the application, run:
npm start
To run requests while the application is running, you will need an API client such as Postman or Insomnia since there is currently no front end. The respective routes that you make requests to are found in /routes/api
. Below is an example of a GET request made in Insomnia:
Remember to make requests to http://localhost:3001
when you run this application locally since that is the default port for the application.