This is a Back end application for an e-commerce site. The application is build with Node.Js and uses the MySQL2 and Sequelize packages to connect your Express.js API to a MySQL database and the dotenv package to use environment variables to store sensitive data.
- Fork repository
- Clone repository to local environment.
- Node.js must be installed.
- To install all the dependencies (dotenv, express, mysql2 and sequelize) use the following command:
npm install
5.Use the .env
file to store sensitive data: MySQL username, password, and database name.
- Loging into MySQL and use the
schema.sql
file in thedb
folder to create your data base with the following MySQL shell command:
source db/shema.sql;
- Seed the database with the following command:
npm run seed
The application is invoked by using the following command (on the directory containing this project):
node server.js
GIVEN a functional Express.js API
WHEN I add my database name, MySQL username, and MySQL password to an environment variable file
THEN I am able to connect to a database using Sequelize
WHEN I enter schema and seed commands
THEN a development database is created and is seeded with test data
WHEN I enter the command to invoke the application
THEN my server is started and the Sequelize models are synced to the MySQL database
WHEN I open API GET routes in Insomnia Core for categories, products, or tags
THEN the data for each of these routes is displayed in a formatted JSON
WHEN I test API POST, PUT, and DELETE routes in Insomnia Core
THEN I am able to successfully create, update, and delete data in my database
This project is covered under the MIT license.
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. Please note we have a code of conduct, please follow it in all your interactions with the project. Contributions follow the Contributor Convenant.