- Go 1.23.4 or later
- MySQL
-
Clone the repository:
git clone https://github.com/MichaelGamel/ecom.git cd ecom -
Install dependencies:
go mod download
-
Set up the environment variables:
cp .env.example .env
-
Update the .env file with your database credentials.
To run the database migrations, use the following commands:
-
To apply migrations:
make migrate-up
-
To rollback migrations:
make migrate-down
To build and run the project, use the following commands:
-
Build the project:
make build
-
Run the project:
make run
The API provides the following endpoints:
-
User Authentication
POST /api/v1/register- Register a new userPOST /api/v1/login- Login a user
-
Product Management
GET /api/v1/products- Get all productsGET /api/v1/products/{productID}- Get a product by IDPOST /api/v1/products- Create a new product (requires authentication)PUT /api/v1/products/{productID}- Update a product (requires authentication)
-
Cart Management
POST /api/v1/cart/checkout- Checkout the cart (requires authentication)
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.