This project involves building the back end for an e-commerce site using Express.js and Sequelize with a PostgreSQL database. It demonstrates a functional API capable of handling CRUD operations for categories, products, and tags. The project includes database configuration, schema creation, and data seeding.
-
Clone the repository:
git clone https://github.com/andrewhamerly/ecommerce-backend.git
-
Navigate to the project directory:
cd ecommerce-backend
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following:DB_NAME=your_database_name DB_USER=your_postgresql_username DB_PASSWORD=your_postgresql_password
-
Create and seed the database:
psql -U postgres \i db/schema.sql npm run seed
-
Start the application:
npm start
-
Testing the API routes: Use Insomnia or a similar API client to test the following routes:
- GET
/api/categories
- GET
/api/products
- GET
/api/tags
- POST
/api/categories
- POST
/api/products
- POST
/api/tags
- PUT
/api/categories/:id
- PUT
/api/products/:id
- PUT
/api/tags/:id
- DELETE
/api/categories/:id
- DELETE
/api/products/:id
- DELETE
/api/tags/:id
- GET
Click here to watch the walkthrough video
- Node.js
- Express.js
- Sequelize
- PostgreSQL
- dotenv
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please fork the repository and create a pull request with your changes. For major changes, please open an issue first to discuss what you would like to change.
If you have any questions about the project, please feel free to contact me via email at contact@andrewhamerly.com. You can also find more of my work on GitHub.