Capstone/ui/main.go

30 lines
489 B
Go
Raw Normal View History

2023-10-23 22:01:09 -04:00
package main
import (
2023-11-19 10:37:45 -05:00
"fmt"
"os"
2023-11-03 20:00:14 -04:00
2023-10-28 17:50:44 -04:00
"git.preston-baxter.com/Preston_PLB/capstone/frontend-service/config"
2023-10-28 14:42:29 -04:00
"git.preston-baxter.com/Preston_PLB/capstone/frontend-service/controllers"
2023-10-23 22:01:09 -04:00
"github.com/gin-gonic/gin"
)
func main() {
2023-10-28 17:50:44 -04:00
config.Init()
2023-10-23 22:01:09 -04:00
r := gin.Default()
2023-10-28 12:34:11 -04:00
2023-10-28 14:42:29 -04:00
controllers.BuildRouter(r)
2023-10-28 12:34:11 -04:00
2023-11-19 10:37:45 -05:00
var addr string
if port := os.Getenv("PORT"); port != "" {
addr = fmt.Sprintf("0.0.0.0:%s", port)
} else {
2023-11-19 21:51:05 -05:00
addr = "0.0.0.0:8080"
2023-11-19 10:37:45 -05:00
}
err := r.Run(addr)
2023-11-03 20:00:14 -04:00
if err != nil {
2023-11-19 10:37:45 -05:00
panic(err)
2023-11-03 20:00:14 -04:00
}
2023-10-23 22:01:09 -04:00
}