-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (31 loc) · 767 Bytes
/
main.go
File metadata and controls
38 lines (31 loc) · 767 Bytes
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
package main
import (
"fmt"
"llm/config"
"llm/db"
"llm/logger"
"llm/router"
"log/slog"
"net/http"
"os"
)
func main() {
// Initialize logger with desired level
logger.InitLogger(slog.LevelDebug)
// Load environment variables
config.LoadConfig()
// Connect to the database
if err := db.Connect(); err != nil {
logger.Logger.Error("Error connecting to the database", "error", err)
os.Exit(1)
}
// Setup routes
router.SetupRoutes()
// Start the server
address := fmt.Sprintf(":%s", config.Port)
logger.Logger.Info("Server is running", slog.String("address", address))
if err := http.ListenAndServe(address, nil); err != nil {
logger.Logger.Error("Server failed", "error", err)
os.Exit(1)
}
}