单元测试
This commit is contained in:
@@ -4,12 +4,24 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"Crimson-Gatekeeper/internal/common"
|
||||
"Crimson-Gatekeeper/internal/user"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
//client, close := common.GetDataBaseClient()
|
||||
//defer close()
|
||||
app, close := launchApplication()
|
||||
err := app.Run(":3333")
|
||||
if err != nil {
|
||||
fmt.Println("应用启动失败")
|
||||
panic(err)
|
||||
}
|
||||
defer close()
|
||||
}
|
||||
|
||||
func launchApplication() (*gin.Engine, func() error) {
|
||||
client, close := common.GetDataBaseClient()
|
||||
app := gin.Default()
|
||||
app.GET("/test", func(ctx *gin.Context) {
|
||||
fmt.Println(ctx.Request.URL.Path)
|
||||
@@ -17,9 +29,6 @@ func main() {
|
||||
"message": "success",
|
||||
})
|
||||
})
|
||||
err := app.Run(":8443")
|
||||
if err != nil {
|
||||
fmt.Println("应用启动失败")
|
||||
panic(err)
|
||||
}
|
||||
user.New(client).RegisterRoute(app)
|
||||
return app, close
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user