mirror of
https://github.com/MedzikUser/go-pingbot
synced 2024-08-14 23:57:07 +00:00
- Change error messages - backend and update: changed files name to ticker.go - Update README, Makefile - Added nodemon - website: URL type now is database.URL - backend: Remove unused http info - Upgrade deps
34 lines
617 B
Go
34 lines
617 B
Go
package website
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/gin-contrib/cors"
|
|
"github.com/gin-gonic/gin"
|
|
"gitlab.com/gaming0skar123/go/pingbot/common"
|
|
"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 common.CheckErr(err, "gin start") {
|
|
os.Exit(1)
|
|
}
|
|
}
|