Example that shows core principles of the Clean Architecture in Golang projects.
More on Clean Architecture can be found here.
Here is an implimentaion of Clean Architecture here.
REST API with custom JWT-based authentication system. Core functionality is about creating and managing products
4 Domain layers:
- Models layer
- Repository layer
- UseCase layer
- Delivery layer
Request to get JWT Token based on user credentials
{
"username": "username",
"password": "password"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzEwMzgyMjQuNzQ0MzI0MiwidXNlciI6eyJJRCI6IjAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCIsIlVzZXJuYW1lIjoiemhhc2hrZXZ5Y2giLCJQYXNzd29yZCI6IjQyODYwMTc5ZmFiMTQ2YzZiZDAyNjlkMDViZTM0ZWNmYmY5Zjk3YjUifX0.3dsyKJQ-HZJxdvBMui0Mzgw6yb6If9aB8imGhxMOjsk"
}
Creates new product
{
"id" : "12345",
"title" : "Walton",
"amount" : 234,
"price" : 23000
}
Returns all products
{
"products": [
{
"id": "5da2d8aae9b63715ddfae856",
"title": "Walton",
"amount": 234,
"price": 23000
}
]
}
Deletes bookmark by ID:
{
"id": "12345"
}
- go 1.13