1 Star 0 Fork 0

dounine/duffett

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.go 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"github.com/gin-gonic/gin"
ginSwagger "github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
appData "duffett/app/data"
appMonitor "duffett/app/monitor"
appOrder "duffett/app/order"
appStock "duffett/app/stock"
appStrategy "duffett/app/strategy"
appUser "duffett/app/user"
_ "duffett/docs"
"duffett/middleware"
"duffett/pkg"
)
func init() {
pkg.InitConfig("conf.yaml")
pkg.InitLog(pkg.DebugLevel)
pkg.InitDB()
pkg.InitJwt()
}
func main() {
router := gin.Default()
// 注册 swagger
// url := ginSwagger.URL("http://localhost:8080/swagger/doc.json")
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
// 配置路由
v1 := router.Group("/api/v1")
{
user := v1.Group("/user")
{
user.POST("/login", appUser.Login)
user.POST("/register", appUser.Register)
user.GET("/testJwt", middleware.JWTAuth(), appUser.TestJwt)
}
data := v1.Group("/data").Use(middleware.JWTAuth())
{
data.POST("/tushare", appData.Tushare)
}
monitor := v1.Group("/monitor")
{
monitor.GET("/ws", appMonitor.WS)
}
stock := v1.Group("/stock").Use(middleware.JWTAuth())
{
stock.GET("/getMonitoringStocks", appStock.GetMonitoringStocks)
stock.GET("/getStocks", appStock.GetStocks)
}
order := v1.Group("/order").Use(middleware.JWTAuth())
{
order.POST("/getOrders", appOrder.GetOrders)
}
strategy := v1.Group("/strategy").Use(middleware.JWTAuth())
{
strategy.GET("/getStrategies", appStrategy.GetStrategies)
strategy.POST("/create", appStrategy.Create)
strategy.POST("/update", appStrategy.Update)
strategy.POST("/delete", appStrategy.Delete)
strategy.POST("/testExec", appStrategy.TestExec)
}
}
// 运行
router.Run(pkg.Conf.Addr)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dounineli/duffett.git
git@gitee.com:dounineli/duffett.git
dounineli
duffett
duffett
master

搜索帮助