diff --git a/README.md b/README.md index 113a393..f3533a7 100644 --- a/README.md +++ b/README.md @@ -43,4 +43,4 @@ The REST API currently exposes these Endpoints: | GET | /mine_block | Mine a block with all pending transactions | | GET | /is_valid | Check, if the chain has any faulty blocks | -Refer to the [wiki](https://github.com/garritfra/blockchain-project/wiki) to get more information about the REST API +Refer to the [wiki](https://github.com/garritfra/blockchain-project/wiki) to get more information about the REST API \ No newline at end of file diff --git a/main.go b/main.go index 8b8784c..5fe0094 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,20 @@ package main import ( + "flag" + "fmt" + "strconv" + "github.com/garritfra/blockchain-project/server" ) func main() { - server.ServeHTTP(":42000") + portFlag := flag.Int("port", 42000, "The port this service is running on") + flag.Parse() + + var port string + port += ":" + port += strconv.Itoa(*portFlag) + fmt.Println(*portFlag) + server.ServeHTTP(port) }