This commit is contained in:
2022-11-22 13:46:44 +08:00
parent 4784078dc7
commit bfe739e442
3 changed files with 10 additions and 3 deletions

View File

@@ -46,7 +46,12 @@ var wsUpgrader = websocket.Upgrader{
func main() {
r := gin.Default()
r.Use(func(c *gin.Context) {
group := r.Group("/")
group.StaticFile("/", "./web/build/index.html")
group.Static("/web", "./web/build")
group.Use(func(c *gin.Context) {
c.Next()
if len(c.Errors) > 0 {
c.JSON(-1, gin.H{
@@ -56,7 +61,7 @@ func main() {
}
})
api := r.Group("/api")
api := group.Group("/api")
api.GET("/timetables", func(c *gin.Context) {
timetables := make([]*db.Timetable, 0)