Browse Source

Add --port flag

now.sh
garritfra 5 years ago
parent
commit
c4096b4a1d
  1. 2
      README.md
  2. 13
      main.go

2
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

13
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)
}

Loading…
Cancel
Save