We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd6e871 commit 7a3e796Copy full SHA for 7a3e796
multiple-servers/cmd/static-server/main.go
@@ -17,6 +17,7 @@ func main() {
17
}
18
19
static.Run(static.Config{
20
- Dir: absPath,
+ Dir: absPath,
21
+ Port: 8080,
22
})
23
multiple-servers/static/static.go
@@ -1,13 +1,15 @@
1
package static
2
3
import (
4
+ "fmt"
5
"log"
6
"net/http"
7
"path/filepath"
8
)
9
10
type Config struct {
- Dir string
11
+ Dir string
12
+ Port int
13
14
15
func Run(config Config) {
@@ -21,5 +23,5 @@ func Run(config Config) {
http.ServeFile(w, r, path)
24
25
- log.Fatal(http.ListenAndServe(":8080", nil))
26
+ log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", config.Port), nil))
27
0 commit comments