go run main.go- GET: retrieve a representation of the resource
- POST: create a new resource
- PUT: update the resource
- PATCH: perform a partial update of a resource, refer to core-go/core and core-go/sql
- DELETE: delete a resource
To check if the service is available.
{
    "status": "UP",
    "details": {
        "sql": {
            "status": "UP"
        }
    }
}[
    {
        "id": "spiderman",
        "username": "peter.parker",
        "email": "peter.parker@gmail.com",
        "phone": "0987654321",
        "dateOfBirth": "1962-08-25T16:59:59.999Z"
    },
    {
        "id": "wolverine",
        "username": "james.howlett",
        "email": "james.howlett@gmail.com",
        "phone": "0987654321",
        "dateOfBirth": "1974-11-16T16:59:59.999Z"
    }
]GET /users/wolverine{
    "id": "wolverine",
    "username": "james.howlett",
    "email": "james.howlett@gmail.com",
    "phone": "0987654321",
    "dateOfBirth": "1974-11-16T16:59:59.999Z"
}{
    "id": "wolverine",
    "username": "james.howlett",
    "email": "james.howlett@gmail.com",
    "phone": "0987654321",
    "dateOfBirth": "1974-11-16T16:59:59.999Z"
}1PUT /users/wolverine{
    "username": "james.howlett",
    "email": "james.howlett@gmail.com",
    "phone": "0987654321",
    "dateOfBirth": "1974-11-16T16:59:59.999Z"
}1Perform a partial update of user. For example, if you want to update 2 fields: email and phone, you can send the request body of below.
PATCH /users/wolverine{
    "email": "james.howlett@gmail.com",
    "phone": "0987654321"
}1DELETE /users/wolverine1- core-go/health: include HealthHandler, HealthChecker, SqlHealthChecker
- core-go/config: to load the config file, and merge with other environments (SIT, UAT, ENV)
- core-go/log: logging
- core-go/middleware: middleware log tracing for echo
To check if the service is available, refer to core-go/health
{
    "status": "UP",
    "details": {
        "sql": {
            "status": "UP"
        }
    }
}To create health checker, and health handler
    db, err := sql.Open(cfg.Driver, cfg.DataSourceName)
    if err != nil {
        return nil, err
    }
    sqlChecker := s.NewSqlHealthChecker(db)
    healthHandler := health.NewHealthHandler(sqlChecker)To load the config from "config.yml", in "configs" folder
package main
import "github.com/core-go/config"
type Config struct {
    DB DatabaseConfig `mapstructure:"db"`
}
type DatabaseConfig struct {
    Driver         string `mapstructure:"driver"`
    DataSourceName string `mapstructure:"data_source_name"`
}
func main() {
    var cfg Config
    err := config.Load(&cfg, "configs/config")
    if err != nil {
        panic(err)
    }
}To configure to ignore the health check, use "skips":
middleware:
  skips: /health
