-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (33 loc) · 812 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
38
39
40
41
42
43
package main
import (
"fmt"
"github.com/gofiber/fiber/v2"
"github.com/joho/godotenv"
"github.com/soulinmaikadua/my-go-fiber/pkg/routes"
)
// var secretKey = []byte("your-secret-key")
func main() {
app := fiber.New()
// Load variables from .env file
godotenv.Load()
app.Get("/", func(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"message": "Hello world!",
})
})
// app.Use(jwtware.New(jwtware.Config{
// SigningKey: jwtware.SigningKey{Key: secretKey},
// }))
// Routes
routes.AuthRoutes(app)
routes.UserRoutes(app)
routes.PostRoutes(app)
routes.NotFoundRoute(app)
port := 6000
addr := fmt.Sprintf(":%d", port)
fmt.Printf("Server is running on http://localhost:%d\n", port)
err := app.Listen(addr)
if err != nil {
fmt.Printf("Error starting the server: %v\n", err)
}
}