-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (31 loc) · 894 Bytes
/
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
package main
import (
"log"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
"github.com/greybluesea/jwt_mvc_on_aws/database"
routes "github.com/greybluesea/jwt_mvc_on_aws/routes"
// "github.com/joho/godotenv"
)
func main() {
/* err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
*/
database.ConnectDB()
engine := html.New("./views", ".html")
app := fiber.New(
fiber.Config{
Views: engine,
ViewsLayout: "layout",
})
app.Get("/", func(c *fiber.Ctx) error {
return c.Render("home", fiber.Map{"Title": "Hello and welcome, this is a JWT-authenticated MVC webapp on AWS👋!"})
// return c.SendString("Hello, welcome to the JWT auth GoFiber api 👋!")
})
routes.SetAuthRoutes(app)
routes.SetUserRoutes(app)
routes.SetSigninRoutes(app)
log.Fatal(app.Listen(":3000"))
}