This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "go.opentelemetry.io/otel" | |
{ | |
ctx := context.Background() | |
// create root span | |
newCtx, span := otel.Tracer(name).Start(ctx, spanName) | |
defer span.End() | |
// add attributes | |
span.SetAttributes(attribute.String("client.name", "jsoto_dev")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"github.com/onflow/cadence" | |
"github.com/onflow/flow-go-sdk" | |
"github.com/onflow/flow-go-sdk/access/http" | |
"github.com/onflow/flow-go-sdk/crypto" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Routes initialize the handlers for the router | |
func Routes() *chi.Mux { | |
router := chi.NewRouter() | |
router.Post("/query", graphQLHandler()) | |
router.Get("/playground", playgroundQLHandler("/v1/query")) | |
return router | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initiliaze will handle the routes for the chi server | |
func initiliaze() *chi.Mux { | |
router := chi.NewRouter() | |
//uses chi middleware logic | |
router.Use( | |
render.SetContentType(render.ContentTypeJSON), | |
middleware.RedirectSlashes, | |
middleware.Recoverer, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Initiliaze will handle the routes for the chi server | |
func initiliaze() *chi.Mux { | |
router := chi.NewRouter() | |
//uses chi middleware logic | |
router.Use( | |
render.SetContentType(render.ContentTypeJSON), | |
middleware.RedirectSlashes, | |
middleware.Recoverer, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go mod init | |
go run github.com/99designs/gqlgen init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go get github.com/99designs/gqlgen | |
go get -u github.com/go-chi/chi |