mirror of
https://github.com/MedzikUser/go-pingbot
synced 2024-08-14 23:57:07 +00:00
- Added Memory stats to API status - Changed Backend Start file and function name - Changed GIN Server panic msg - Upgrade deps
31 lines
574 B
Go
31 lines
574 B
Go
package website
|
|
|
|
import (
|
|
"github.com/gin-contrib/cors"
|
|
"github.com/gin-gonic/gin"
|
|
"gitlab.com/gaming0skar123/go/pingbot/config"
|
|
"gitlab.com/gaming0skar123/go/pingbot/website/routes"
|
|
"gitlab.com/gaming0skar123/go/pingbot/website/routes/api"
|
|
)
|
|
|
|
var router *gin.Engine
|
|
|
|
func Server() {
|
|
// Disable GIN Debug
|
|
gin.SetMode(gin.ReleaseMode)
|
|
|
|
router = gin.New()
|
|
|
|
// Allows all origins
|
|
router.Use(cors.Default())
|
|
|
|
router.GET("/", routes.Index)
|
|
|
|
api.ApplyRoutes(router)
|
|
|
|
err := router.Run(config.Port)
|
|
if err != nil {
|
|
panic("Starting GIN Server: " + err.Error())
|
|
}
|
|
}
|