feat: init commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"eden-server/internal/runtime"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func KickoffApi(env runtime.Environment, db *gorm.DB) {
|
||||
router := gin.Default()
|
||||
router.LoadHTMLFiles("./web/templates/index.html")
|
||||
|
||||
spawnRoutes(router, env, db)
|
||||
|
||||
err := router.Run(fmt.Sprintf("%s:%s", env.Hostname, env.Port))
|
||||
if err != nil {
|
||||
slog.Error("failed to start the Gin server due to: " + err.Error())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user