-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
51 lines (46 loc) · 1.23 KB
/
main.go
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
42
43
44
45
46
47
48
49
50
51
package main
import (
"encoding/gob"
"log"
"time"
"github.com/U-to-E/dashboard/controller"
"github.com/U-to-E/dashboard/database"
"github.com/U-to-E/dashboard/routes"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/cors"
"github.com/gofiber/fiber/v3/middleware/logger"
"github.com/gofiber/fiber/v3/middleware/session"
"github.com/gofiber/template/html/v2"
)
var store *session.Store
func main() {
gob.Register(time.Time{})
engine := html.New("./views", ".html")
app := fiber.New(fiber.Config{
Views: engine,
})
store = session.New(session.Config{
CookieHTTPOnly: true,
CookieSecure: true,
CookieSameSite: "Lax",
})
controller.Session(store)
app.Static("/", "./materials")
app.Static("/asserts", "./static")
app.Static("/cert", "./certificates")
// app.Get("/metrics", monitor.New())
// app.Use(csrf.New())
// app.Use(csrf.New(csrf.Config{
// KeyLookup: "header:X-Csrf-Token",
// CookieName: "csrf_",
// CookieSameSite: "Lax",
// CookieHTTPOnly: true,
// CookieSecure: true,
// Expiration: 1 * time.Hour,
// KeyGenerator: utils.UUIDv4,
// }))
app.Use(cors.New(), logger.New())
database.Connect()
routes.SetupStudentRoutes(app)
log.Fatal(app.Listen(":3000"))
}