Echo Clean Architecture
Straightforward Online Shop backend application with simplified Clean Architecture. Created with Go Echo - MySQL - GORM.
- Add environment variables to
.env
file as usual. Below are example of the configurations.
DB_USER=<db_username>
DB_PASS=<db_password>
DB_HOST=<db_host>
DB_PORT=<db_port>
DB_NAME=<db_name>
DB_TYPE=<db_type>
PORT=<server_port>
-
You can migrate the testing database with the provided
src/schema/migrate.sql
script or initialize an empty database with defined tables throughsrc/schema/database.sql
script. This project is tested with MariaDB-flavoured MySQL (v8.0.27). -
Simply execute
go build
orgo run .
to install all dependencies fromgo mod
and run the server.
root
: /api/v1
root
: /members
POST /
{
"username": string,
"gender": enum("Male", "Female"),
"skin_type": enum("Normal", "Sensitive", "Dry", "Oily"),
"skin_color": enum("White", "Yellow", "Black")
}
PUT /:member_id
{
"username": string,
"gender": enum("Male", "Female"),
"skin_type": enum("Normal", "Sensitive", "Dry", "Oily"),
"skin_color": enum("White", "Yellow", "Black")
}
DELETE /:member_id
GET /
root
: /reviews
GET /:product_id
root
: /like_reviews
POST /like
{
"review_id": string,
"member_id": string
}
POST /unlike
{
"review_id": string,
"member_id": string
}
- After trying it,
GORM
, in my opinion, is not really a good ORM library for Go. Will need to try another ORM libraries. - Several APIs might lack clarities in the response due to the ORM.