Initial HTTP server
This commit is contained in:
20
main.go
20
main.go
@@ -3,5 +3,25 @@ package main
|
|||||||
// import "fmt"
|
// import "fmt"
|
||||||
// import "github.com/google/uuid"
|
// import "github.com/google/uuid"
|
||||||
|
|
||||||
|
import "flag"
|
||||||
|
import "log"
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
var bindFlag = flag.String("listen", "[::]:8100", "host:port to listen on")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
mux := http.NewServeMux()
|
||||||
|
srv := &http.Server{
|
||||||
|
Addr: *bindFlag,
|
||||||
|
Handler: mux,
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("listening on %s", *bindFlag)
|
||||||
|
|
||||||
|
err := srv.ListenAndServe()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func TestStore(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if out1.Opaque != "foo" {
|
if out1.Opaque != "foo" {
|
||||||
t.Errorf("Mismatach: %+v", out1)
|
t.Errorf("%+v", out1)
|
||||||
}
|
}
|
||||||
|
|
||||||
out2 := &storeTest{
|
out2 := &storeTest{
|
||||||
@@ -51,7 +51,7 @@ func TestStore(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if out2.Opaque != "bar" {
|
if out2.Opaque != "bar" {
|
||||||
t.Errorf("Mismatach: %+v", out2)
|
t.Errorf("%+v", out2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user