first commit
This commit is contained in:
34
main.go
Normal file
34
main.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"simple-cluster-node/router"
|
||||
|
||||
log "gitlab.com/gdulai/simpleloglvl"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Setup logs
|
||||
log.SetupLogs()
|
||||
|
||||
log.LogInfo("Application starting...")
|
||||
|
||||
// Load env file
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
log.LogFatalError("Failed to load .env file")
|
||||
}
|
||||
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = "8080"
|
||||
}
|
||||
|
||||
log.LogInfo("Application started on port %s", port)
|
||||
|
||||
r := router.SetupRouter()
|
||||
http.ListenAndServe(":"+port, r)
|
||||
}
|
||||
Reference in New Issue
Block a user