DB640/internal/web/web.go

27 lines
522 B
Go
Raw Normal View History

2020-04-05 20:06:15 +00:00
package web
import (
"path"
"git.1750studios.com/ToddShepard/DB640/internal/config"
2020-04-10 16:16:16 +00:00
"github.com/gin-contrib/cors"
2020-04-05 20:06:15 +00:00
"github.com/gin-gonic/gin"
)
// Init intizializes the web server
func Init() {
r := gin.Default()
2020-04-10 16:16:16 +00:00
r.Use(cors.Default())
2020-04-05 20:06:15 +00:00
r.Static("/static", path.Join(config.C.Web.WebDir, "static"))
r.GET("/betriebsstellen/", getBetriebsstellen)
r.GET("/betriebsstellen/:code", getBetriebsstelleByCode)
if config.C.Web.BindUnix {
2020-04-11 03:16:48 +00:00
go r.RunUnix(config.C.Web.Bind)
2020-04-05 20:06:15 +00:00
} else {
2020-04-11 03:16:48 +00:00
go r.Run(config.C.Web.Bind)
2020-04-05 20:06:15 +00:00
}
}