Skip to content

essential2189/go-fiber-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-boilerplate v1.1.1

go version - 1.2.1

Must Changed Before Use

  • The module name in go.mod file
  • The AppName in app.go file
  • The historyType and version in logger.go

How to Run

Install required packages

  • go mod tidy or go mod vendor
  • go install github.com/cosmtrek/air@latest
  • go install github.com/swaggo/swag/cmd/swag@latest

Run

env : APP_HOME, DEBUG, TEST, env, port

  • env=dev air - Run the server with hot reload
  • swag init - Generate swagger docs
  • docker build -t go-boilerplate . - Build docker image
  • docker run -e "env=dev" -p 8080:8080 go-boilerplate - Run docker image

Library

Resty Example

url := config.Apis + consts.GetProductDetailUrl + strconv.Itoa(paymentID)

requestInfo := resty.RequestInfo{
    Uri:          url,
    Method:       resty.MethodGET,
    Headers:      map[string]string{"Content-Type": "application/json"},
    Query:        map[string]string{},
    Body:         nil,
    Timeout:      0,
    RetryCount:   0,
    RetryBackOff: 0,
    IsSkipSSL:    false,
}

res, err := svc.resty.Request(requestInfo)
if err != nil {
    return errors.Wrap(err, "failed to get product detail")
}

err = json.Unmarshal(res.Body, &productDetail)
if err != nil {
    return errors.Wrap(err, "failed to unmarshal message")
}

About

go-fiber-boilerplate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published