-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (34 loc) · 842 Bytes
/
main.go
File metadata and controls
41 lines (34 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"quantix-math/pkg/db"
"quantix-math/pkg/utility/loader"
"quantix-math/routes" // Import the new routes package
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
)
func main() {
// init database
_, err := db.InitDatabase()
if err != nil {
fmt.Printf("Database initialization failed: %v\n", err)
return
}
loader.LoadWords()
// Initialize standard Go html template engine
engine := html.New("./views", ".tmpl")
// Pass the engine to the Fiber app
app := fiber.New(fiber.Config{
Views: engine,
ViewsLayout: "layouts/main",
})
// Setup Routes
app.Static("/assets", "./assets")
routes.RegisterAPIRoutes(app)
routes.SetupUIRoutes(app)
listenErr := app.Listen(":3301")
if listenErr != nil {
fmt.Printf("Server failed to start: %v\n", listenErr)
return
}
}