use port supplied to the program by tags

This commit is contained in:
2023-07-22 11:11:20 +01:00
parent 01b3b7b429
commit e82adbe5e4
2 changed files with 5 additions and 1 deletions

BIN
main

Binary file not shown.

View File

@@ -2,6 +2,7 @@ package main
import (
"database/sql"
"flag"
"github.com/gin-gonic/gin"
_ "github.com/mattn/go-sqlite3"
"net/http"
@@ -246,6 +247,9 @@ func getUserPoints(c *gin.Context) {
}
func main() {
var port string
flag.StringVar(&port, "port", "localhost:8080", "define the port you want the program to use to serve")
flag.Parse()
//release mode
//gin.SetMode(gin.ReleaseMode)
router := gin.Default()
@@ -265,7 +269,7 @@ func main() {
})
router.Static("/frontend", "./frontend")
router.Run("localhost:8080")
router.Run(port)
}
func checkErr(err error) {