Checking in cmd files | first attempt at linking up item service
This commit is contained in:
39
services/front/cmd/front-cli/http.go
Normal file
39
services/front/cmd/front-cli/http.go
Normal file
@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
cli "crossnokaye-interview-assignment/services/front/gen/http/cli/front"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
goahttp "goa.design/goa/v3/http"
|
||||
goa "goa.design/goa/v3/pkg"
|
||||
)
|
||||
|
||||
func doHTTP(scheme, host string, timeout int, debug bool) (goa.Endpoint, any, error) {
|
||||
var (
|
||||
doer goahttp.Doer
|
||||
)
|
||||
{
|
||||
doer = &http.Client{Timeout: time.Duration(timeout) * time.Second}
|
||||
if debug {
|
||||
doer = goahttp.NewDebugDoer(doer)
|
||||
}
|
||||
}
|
||||
|
||||
return cli.ParseEndpoint(
|
||||
scheme,
|
||||
host,
|
||||
doer,
|
||||
goahttp.RequestEncoder,
|
||||
goahttp.ResponseDecoder,
|
||||
debug,
|
||||
)
|
||||
}
|
||||
|
||||
func httpUsageCommands() string {
|
||||
return cli.UsageCommands()
|
||||
}
|
||||
|
||||
func httpUsageExamples() string {
|
||||
return cli.UsageExamples()
|
||||
}
|
Reference in New Issue
Block a user