-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
63 lines (48 loc) · 1.11 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"context"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/nasissa97/ddd-with-go/fundamentals"
"github.com/nasissa97/ddd-with-go/fundamentals/oapi"
"github.com/nasissa97/ddd-with-go/patterns"
)
const BaseURL string = "0.0.0.0:8080"
func failed_attempt() {
server := fundamentals.NewServer()
r := mux.NewRouter()
h := oapi.HandlerFromMux(server, r)
s := &http.Server{
Handler: h,
Addr: BaseURL,
}
go func() {
log.Fatal(s.ListenAndServe())
}()
// provider := oapi.NewAuthProvider("example")
localhost := oapi.WithBaseURL(BaseURL)
// TODO: Figure out how to add PORT to Client. Otherwise Docker
client, err := oapi.NewClientWithResponses(BaseURL, localhost)
if err != nil {
log.Printf("Failed to crate new client: %v", err)
}
ctx := context.Background()
res, err := client.GetUsers(ctx)
if err != nil {
log.Printf("Failed to get users: %v", err)
}
fmt.Println(res)
}
func main() {
myCar, err := patterns.BuildCar("tesla")
if err != nil {
log.Fatal(err)
}
myCar.Honk()
_, err = patterns.BuildCar("Chevy")
if err != nil {
log.Print(err)
}
}