electron-egg electron-egg
首页
  • v4.x
  • v3.x
  • v2.x
插件
  • v4.x
  • v3.x
demo
支持
知识点
案例
交流
  • GitHub (opens new window)
  • Gitee (opens new window)
首页
  • v4.x
  • v3.x
  • v2.x
插件
  • v4.x
  • v3.x
demo
支持
知识点
案例
交流
  • GitHub (opens new window)
  • Gitee (opens new window)
❤️成为赞助商
  • 快速入门

  • 基础功能

  • 生成软件

  • 升级

  • 跨语言支持

    • 介绍
    • go

      • 开始
      • 配置
      • 开发
      • 构建
      • 日志
      • 数据
      • main.go
      • 路由
      • 业务层
        • API
      • java

      • python

    • 更新记录
    • 常见问题
    目录

    业务层

    您可以在 ./go/api 中编写业务。

    # 使用方法

    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"
    )
    
    // 使用 router Ctx
    // Ctx将封装一些通用功能,如 日志(请求路径、接口耗时 ...) 等
    func Hello(c *router.Ctx) {
    	ret := ehelper.GetJson()
    	defer c.JSON(ret)
    
    	ret.Data = "hello electron-egg"
    	elog.Logger.Info(" print Hello ")
    }
    
    // 使用 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()
    }
    
    上次更新: 2025/06/06, 07:21:49
    路由
    API

    ← 路由 API→

    Theme by Vdoing | Copyright © 2023-2025 哆啦好梦 | 京ICP备15041380号-2
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式
    ×