Skip to content

Instantly share code, notes, and snippets.

View javiersoto15's full-sized avatar
Brewing coffee and coding

Javier Soto javiersoto15

Brewing coffee and coding
View GitHub Profile
@javiersoto15
javiersoto15 / trace_basic.go
Last active December 28, 2022 15:37
Basic Tracing
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"))
@javiersoto15
javiersoto15 / flow.go
Created December 16, 2022 17:58
Full Flow Program
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"
//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
}
//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,
)
//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,
)
@javiersoto15
javiersoto15 / gocmd2.txt
Last active May 18, 2020 19:11
Go modules and GQLGen generate
go mod init
go run github.com/99designs/gqlgen init
@javiersoto15
javiersoto15 / gomod.txt
Last active May 18, 2020 19:12
Command for Go packages
go get github.com/99designs/gqlgen
go get -u github.com/go-chi/chi