myply Server

This is a repository for myply server

myply

local

  • pre-commit
    • goimports
    • golint
    • gofmt

$ cp pre-commit.example .git/hooks/pre-commit
$ chmod +x .git/hooks/pre-commit
  • run

$ go mod tidy
$ make local
GO111MODULE=on go run ./application/cmd/main.go

 ┌───────────────────────────────────────────────────┐ 
 │                   Fiber v2.34.1                   │ 
 │               http://127.0.0.1:3000               │ 
 │       (bound on host 0.0.0.0 and port 3000)       │ 
 │                                                   │ 
 │ Handlers ............. 2  Processes ........... 1 │ 
 │ Prefork ....... Disabled  PID ............. 11610 │ 
 └───────────────────────────────────────────────────┘ 

# 127.0.0.1:8080/swagger/index.html
  • docker
$ make docker.fiber

prod

directory structure

├── application // Interface layer and Application Services in hexagonal architecture
   ├── cmd // command line interface
   ├── controller // http controller
   ├── middleware // http middleware, it can wrap errors or set request uuid or jwt authorization
   └── routes // http router
├── domain // domain layer
   ├── entity
   ├── repository // same as Port in hexagonal architecture
   ├── service // domain service layer
   └── vo // value object
├── go.mod
├── infrastructure // infrastructure layer in hexagonal
   ├── clients // external APIs (E.g. google client, firebase client ..)
   ├── configs // configuration of fiber app 
   ├── logger
   └── persistence // Impl of /domain/repository interface, database persistence layer(E.g. mysql, postgreSQL, mongo, redis ..)
└── pre-commit.example // go fmt before commit

refs

GitHub

View Github