You can write your business logic in ./go/api.
Usage
go
package api
import (
"net/http"
"github.com/wallace5303/ee-go/eapp"
"github.com/wallace5303/ee-go/ehelper"
"github.com/wallace5303/ee-go/ehttp/router"
"github.com/wallace5303/ee-go/elog"
"github.com/gin-gonic/gin"
)
// Using router Ctx
// Ctx wraps some common functionality, such as logging (request path, API latency, etc.)
func Hello(c *router.Ctx) {
ret := ehelper.GetJson()
defer c.JSON(ret)
ret.Data = "hello electron-egg"
elog.Logger.Info(" print Hello ")
}
// Using gin Context
func Info(gc *gin.Context) {
ret := ehelper.GetJson()
defer gc.JSON(http.StatusOK, ret)
elog.Logger.Info(" print info ")
}
func Exit(c *router.Ctx) {
ret := ehelper.GetJson()
defer c.JSON(ret)
eapp.Close()
}