added routes package and serve in server package
This commit is contained in:
1 parent
303b9344f8
commit
547949795f
8 files changed
+74
-77
No files matched your search
+1
-22
@@ -2,33 +2,12 @@ package main
|
||||
|
||||
import (
|
||||
"backend/server"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := fiber.New()
|
||||
|
||||
server.Configure(app)
|
||||
|
||||
enableTls, err := strconv.ParseBool(os.Getenv("ENABLE_TLS"))
|
||||
if err != nil {
|
||||
log.Fatalf("error read tls configuration, %v", err)
|
||||
}
|
||||
if enableTls {
|
||||
log.Fatal(
|
||||
app.ListenTLS(
|
||||
os.Getenv("HTTP_ADDRESS"),
|
||||
os.Getenv("CERT_FILE"),
|
||||
os.Getenv("KEY_FILE"),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
log.Fatal(
|
||||
app.Listen(os.Getenv("HTTP_ADDRESS")),
|
||||
)
|
||||
}
|
||||
server.Serve(app)
|
||||
}
|
||||
Reference in new issue
Block a user