clean_architecture

module
v0.0.0-...-5dd97c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2021 License: MIT

README

Clean Architecture Simple App

Build Go Report Card GitHub 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:

 git clone git@github.com:cyruzin/clean_architecture.git

Install Go dependencies:

 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.

 mv .env.example .env

Running

Cli

Go to the cli folder:

 cd cmd/cli

Then, run the command below:

  go run main.go BBB AAA
Rest Server

Go to the routes folder:

 cd cmd/routes

Then, run the command below:

  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:

{
  "departure": "BBB",
  "destination": "AAA",
  "price": 76
}

Libs

  • go-chi
  • json-iterator
  • zerolog
  • envconfig

License

MIT

Directories

Path Synopsis
cmd
cli
modules
pkg
csv

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL