Module 13 - Object-Relational Mapping (ORM) Challenge: E-commerce Back End
This is the backend for an ecommerce web application, built using Express.js and Sequelize ORM to interact with a MySQL database.
Challenge.13.-.shopping.backend.ORM.mp4
The database uses Sequelize as an ORM to interact with a MySQL database. Models and associations are defined to represent the database structure.
The API provides routes for managing and accessing data for products, categories, and tags.
The routes implement full CRUD functionality using REST conventions:
- GET all and single items
- POST to create new items
- PUT to update existing items by id
- DELETE to remove items by id
- Clone this GitHub repository to your local machine.
git clone https://github.com/CypherNyx/shopping-backend-orm.git
- Open a terminal or command prompt and navigate to the cloned repository's directory.
- Run
npm i
to install the necessary dependencies. - Configure .env with your DB credentials
- Run
node seeds/index.js
to seed the DB (optional) - Run npm start to start the server on localhost
- Node.js
- Express
- Sequelize ORM
- MySQL
- dotenv
- mysql2
The API can be tested locally using a REST client like Insomnia or Postman. The routes can be accessed from the defined base URL.
Some key routes include:
- GET /api/products
- GET /api/categories
- POST /api/products
- PUT /api/categories/1
- DELETE /api/tags/1
- Seed data is provided to prepopulate the database with products, categories and tags.
Pull requests are welcome. Please open an issue first to discuss any proposed changes or additions.
https://opensource.org/licenses/MIT
This project is open source and available under the MIT License.
GitHub CypherNyx
Email: [email protected]