feat: better example for the hook.

This commit is contained in:
Andrey Parhomenko 2024-01-15 04:01:03 +03:00
parent eaad1cbc06
commit 121e1470dc

View file

@ -10,6 +10,9 @@ import (
) )
type Context = bond.Context type Context = bond.Context
var (
gclient *amo.Client
)
var root = bond.Root(bond.Path(). var root = bond.Root(bond.Path().
Def( Def(
@ -45,11 +48,6 @@ Def(
)) ))
func main() { func main() {
srv := bond.Server{
Addr: ":15080",
Handler: root,
}
go srv.ListenAndServe()
opts := &amo.Options{ opts := &amo.Options{
Url: os.Getenv("AMO_URL"), Url: os.Getenv("AMO_URL"),
@ -65,13 +63,21 @@ func main() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
gclient = client
if pair != nil { if pair != nil {
fmt.Println("%q", pair) fmt.Println("PAIR: %q", pair)
} }
company, err := client.GetCompany("80699047", "") /*company, err := client.GetCompany("80699047", "")
if err != nil {
panic(err)
}*/
srv := bond.Server{
Addr: ":15080",
Handler: root,
}
err = srv.ListenAndServe()
if err != nil { if err != nil {
panic(err) panic(err)
} }
fmt.Println(company)
} }