use port supplied to the program by tags
This commit is contained in:
6
main.go
6
main.go
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"flag"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -246,6 +247,9 @@ func getUserPoints(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
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
|
//release mode
|
||||||
//gin.SetMode(gin.ReleaseMode)
|
//gin.SetMode(gin.ReleaseMode)
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
@@ -265,7 +269,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
router.Static("/frontend", "./frontend")
|
router.Static("/frontend", "./frontend")
|
||||||
|
|
||||||
router.Run("localhost:8080")
|
router.Run(port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkErr(err error) {
|
func checkErr(err error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user