-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (34 loc) · 1.08 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
package main
import (
"log"
// "github.com/devMukulSingh/billManagementServer.git/db"
"github.com/devMukulSingh/billManagementServer.git/dbConnection"
"github.com/devMukulSingh/billManagementServer.git/lib"
"github.com/devMukulSingh/billManagementServer.git/router"
// "github.com/devMukulSingh/billManagementServer.git/valkeyCache"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/joho/godotenv"
// "gorm.io/gorm"
)
func main() {
if err := godotenv.Load(".env"); err != nil {
log.Print("Error loading dotenv : " + err.Error())
}
app := fiber.New()
app.Use(logger.New())
app.Use(cors.New(cors.Config{
AllowOrigins: utils.GetBaseUrlClient(),
}))
// if err := valkeyCache.Connect();err!=nil{
// log.Printf("Error connecting to valkey : %s",err.Error())
// }
if err := dbconnection.ConnectDb(); err!=nil{
log.Fatalf("Error in connection db : %s",err.Error())
}
defer dbconnection.Connection.Close()
router.SetupRoutes(app)
log.Print("Server is running at 8000")
app.Listen(":8000")
}