App config
This commit is contained in:
@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"products/app/cfg"
|
||||
"products/app/db"
|
||||
"strconv"
|
||||
|
||||
@ -10,9 +11,6 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const HOST = "0.0.0.0"
|
||||
const PORT = 3000
|
||||
|
||||
func handlePing(c *gin.Context) {
|
||||
c.JSON(
|
||||
http.StatusOK,
|
||||
@ -86,7 +84,8 @@ func initRouter(dbConn *gorm.DB) *gin.Engine {
|
||||
}
|
||||
|
||||
func Serve(dbConn *gorm.DB) {
|
||||
serverAddr := fmt.Sprintf("%s:%d", HOST, PORT)
|
||||
serverAddr := fmt.Sprintf("%s:%d", cfg.Config.AppHost, cfg.Config.AppPort)
|
||||
fmt.Printf("Starting serving on %s\n", serverAddr)
|
||||
|
||||
router := initRouter(dbConn)
|
||||
router.Run(serverAddr)
|
||||
|
||||
Reference in New Issue
Block a user