-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
executable file
·65 lines (48 loc) · 1.79 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"log"
"github.com/emarifer/gofiber-htmx-sessions/db"
"github.com/emarifer/gofiber-htmx-sessions/routes"
"github.com/emarifer/gofiber-htmx-sessions/sessions"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/template/html/v2"
)
func init() {
// Create/migrate DB
db.MakeMigrations()
// Init sessions store
sessions.InitSessionsStore()
}
func main() {
// We make sure that when leaving the connection with the DB is closed
defer db.Db.Close()
// Create a new engine
engine := html.New("./views", ".html")
// Pass the engine to the Views
app := fiber.New(fiber.Config{
Views: engine,
ViewsLayout: "base.layout",
})
app.Static("/", "./assets")
app.Use(logger.New())
routes.SetupRoutes(app)
log.Fatal(app.Listen(":3000"))
}
/* CENTRADO CON POSITION RESPONSIVE. VER:
https://stackoverflow.com/questions/1776915/how-can-i-center-an-absolutely-positioned-element-in-a-div#23384995
FLASH MESSAGES IN GO FIBER. VER:
https://github.com/sujit-baniya/flash
USO DE VARIABLES EN CICLOS "RANGE". VER:
https://stackoverflow.com/questions/43263280/go-template-cant-evaluate-field-x-in-type-y-x-not-part-of-y-but-stuck-in-a#43263399
REFERENCES:
https://blog.bytebytego.com/p/password-session-cookie-token-jwt
https://docs.gofiber.io/api/middleware/session
https://github.com/gofiber/storage/
https://github.com/gofiber/storage/tree/main/sqlite3
https://github.com/gofiber/recipes/tree/master/sessions-sqlite3
https://www.techtarget.com/searchdatamanagement/definition/RDBMS-relational-database-management-system
https://www.epochconverter.com/
https://stackoverflow.com/questions/1409649/how-to-change-the-height-of-a-br
https://stackoverflow.com/questions/1776915/how-can-i-center-an-absolutely-positioned-element-in-a-div#23384995
*/