https://github.com/cyruzin/clean_architecture
Clean Architecture Simple App.
https://github.com/cyruzin/clean_architecture
clean-architecture clean-code example go golang robert-c-martin
Last synced: 15 days ago
JSON representation
Clean Architecture Simple App.
- Host: GitHub
- URL: https://github.com/cyruzin/clean_architecture
- Owner: cyruzin
- License: mit
- Created: 2020-08-18T02:33:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-11T16:16:35.000Z (almost 5 years ago)
- Last Synced: 2024-06-20T17:48:57.567Z (over 1 year ago)
- Topics: clean-architecture, clean-code, example, go, golang, robert-c-martin
- Language: Go
- Homepage:
- Size: 766 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Clean Architecture Simple App
[](https://github.com/cyruzin/clean_architecture/actions?query=workflow%3ABuild+branch%3Amaster) [](https://goreportcard.com/report/github.com/cyruzin/clean_architecture) [](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)
This repo contains a simple command line tool and a rest server that checks the best price between two destinations.
## Architecture
For the system architecture I have decided to use the Clean Architecture proposed by Robert C. Martin (Uncle Bob).
Pull requests are welcome.

## Install
Make sure you have Git and Go installed in you machine.
Clone the repo:
```sh
git clone git@github.com:cyruzin/clean_architecture.git
```
Install Go dependencies:
```go
go mod download
```
If you want to modify the default values, rename the .env.example file to .env and change the values if you want.
```sh
mv .env.example .env
```
## Running
### Cli
Go to the cli folder:
```sh
cd cmd/cli
```
Then, run the command below:
```go
go run main.go BBB AAA
```
### Rest Server
Go to the routes folder:
```sh
cd cmd/routes
```
Then, run the command below:
```go
go run main.go
```
Default Base URL: http://localhost:8000
End-points:
GET - /route
Params required: departure, destination
Eg: http://localhost:8000/route?departure=BBB&destination=AAA
POST - /route
Params required: departure, destination, price
Eg: http://localhost:8000/route
JSON Payload:
```json
{
"departure": "BBB",
"destination": "AAA",
"price": 76
}
```
## Libs
- go-chi
- json-iterator
- zerolog
- envconfig
## License
MIT