Add stub for doll-master and doll services, add required vendored libs
This commit is contained in:
23
cmd/doll-master/main.go
Normal file
23
cmd/doll-master/main.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"doll/internal/log"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Register http-request handler.
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Doll-master here!")
|
||||
})
|
||||
|
||||
// And run server on 8240 port.
|
||||
log.Info("Starting server at port 8240")
|
||||
|
||||
if err := http.ListenAndServe(":8240", nil); err != nil {
|
||||
log.Fatalf("Error starting the server: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: set ft=go noet ai ts=4 sw=4 sts=4: */
|
||||
26
cmd/doll/main.go
Normal file
26
cmd/doll/main.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"doll/internal/log"
|
||||
|
||||
"github.com/carlmjohnson/requests"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var (
|
||||
ctx = context.Background()
|
||||
body string
|
||||
userAgent = "doll"
|
||||
url = "http://localhost:8240/"
|
||||
err error
|
||||
)
|
||||
|
||||
if err = requests.URL(url).UserAgent(userAgent).ToString(&body).Fetch(ctx); err != nil {
|
||||
log.Fatalf("unable to GET %s: %s", url, err)
|
||||
}
|
||||
|
||||
log.Infof("Response is: %s", body)
|
||||
}
|
||||
|
||||
/* vim: set ft=go noet ai ts=4 sw=4 sts=4: */
|
||||
Reference in New Issue
Block a user