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 (
|
||||
"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) {
|
||||
|
||||
Reference in New Issue
Block a user