echo-clean-api

command module
v0.0.0-...-4045c10 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: MIT Imports: 5 Imported by: 0

README

echo-clean-api

A sample REST API based on clean architecture using GO framework echo.

Features

echo-clean-api is demonstration of CRUD API for a simple user management system. To test API also includes simple REPL CLI client tool.

How to run

DB migration

By default, app uses local mysql DB which dns is "root@tcp(127.0.0.1:3306)/echo". So first, create database 'echo' before migration. After that, run migration command.

go run main.go migrate
Run server

Run echo server on "localhost:8000" by this command.

go run main.go server
Run client shell

Run API client tool by this command.

go run main.go client

When started shell, command list are displayed as follows.

% go run main.go client
Client shell start.

Commands:
  clear       clear the screen
  create      create user. input: > create {name}
  delete      delete user. input: > delete {id}
  exit        exit the program
  get         get user list. input: > get
  help        display help
  update      update user name. input: > update {id} {name}

>>>

Directory structure

The application has the following directory structure.

app
├── adapter
│   ├── controller
│   ├── interactor
│   ├── presenter
│   └── repository
├── core
│   ├── domain
│   │   └── entity
│   │       └── user
│   ├── presentation
│   │   └── response
│   └── usecase
└── driver
    ├── client
    ├── db
    │   ├── mockdb
    │   ├── rdb
    │   └── seed
    ├── echo
    │   ├── routes
    │   └── server
    └── log

Based on the clean architecture, it has the following dependency directions.

 ┌────────┐      ┌─────────┐      ┌────────┐  
 │ driver │ ───> │ adapter │ ───> │  core  │ 
 └────────┘      └─────────┘      └────────┘ 

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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