Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eminetto/clean-architecture-go-v2
Clean Architecture sample
https://github.com/eminetto/clean-architecture-go-v2
clean-architecture go
Last synced: about 1 month ago
JSON representation
Clean Architecture sample
- Host: GitHub
- URL: https://github.com/eminetto/clean-architecture-go-v2
- Owner: eminetto
- Archived: true
- Created: 2020-06-25T14:46:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-26T12:44:58.000Z (over 1 year ago)
- Last Synced: 2024-09-21T22:02:36.198Z (about 1 month ago)
- Topics: clean-architecture, go
- Language: Go
- Homepage:
- Size: 11 MB
- Stars: 1,276
- Watchers: 39
- Forks: 227
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- go-awesome - Clean Architecture in Go - Clean architecture example (Open source library / DDD Framework)
- awesome-golang-repositories - clean-architecture-go-v2
README
# Clean Architecture in Go
**This old repository doesn't represent what I'm using nowadays. In 2023, I am using and recommending what my colleagues and I have described in [this post](https://medium.com/inside-picpay/organizing-projects-and-defining-names-in-go-7f0eab45375d)**
[![Build Status](https://travis-ci.org/eminetto/clean-architecture-go-v2.svg?branch=master)](https://travis-ci.org/eminetto/clean-architecture-go-v2)
[Post: Clean Architecture, 2 years later](https://eltonminetto.dev/en/post/2020-07-06-clean-architecture-2years-later/)
## Build
make
## Run tests
make test
## API requests
### Add book
```
curl -X "POST" "http://localhost:8080/v1/book" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"title": "I Am Ozzy",
"author": "Ozzy Osbourne",
"pages": 294,
"quantity":10
}'
```
### Search book```
curl "http://localhost:8080/v1/book?title=ozzy" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
```### Show books
```
curl "http://localhost:8080/v1/book" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
```### Add user
```
curl -X "POST" "http://localhost:8080/v1/user" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d $'{
"email": "[email protected]",
"first_name": "Ozzy",
"last_name": "Osbourne",
"password": "bateater666"
}'```
### Search user```
curl "http://localhost:8080/v1/user?name=ozzy" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
```### Show users
```
curl "http://localhost:8080/v1/user" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
```### Borrow a book
```
curl "http://localhost:8080/v1/loan/borrow/be8b1757-b043-4dbd-b873-63fa9ecd8bb1/282885d7-5d5e-4205-87eb-edc2b2ac5022" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
```### Return a book
```
curl "http://localhost:8080/v1/loan/return/be8b1757-b043-4dbd-b873-63fa9ecd8bb1" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
```## CMD
### Search for a book
```
./bin/search ozzy
```