Skip to content

Commit

Permalink
Merge branch 'feat/newmodules'
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandobandeira committed Dec 1, 2022
2 parents 4477a50 + dce2504 commit e2d60bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 7 additions & 0 deletions pkg/graphql/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ import (
"github.com/99designs/gqlgen/graphql/handler"

thunderGraphql "github.com/gothunder/thunder/internal/graphql"
"github.com/gothunder/thunder/pkg/router"
)

func CreateHandler(graphQLSchema graphql.ExecutableSchema) *handler.Server {
return thunderGraphql.CreateHandler(graphQLSchema)
}

func newGraphqlHandler(graphQLSchema graphql.ExecutableSchema) router.HandlerOutput {
return router.HandlerOutput{
Handler: thunderGraphql.NewGraphqlHandler(graphQLSchema),
}
}
3 changes: 1 addition & 2 deletions pkg/graphql/module.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package graphql

import (
"github.com/gothunder/thunder/internal/graphql"
"go.uber.org/fx"
)

var Module = fx.Options(
fx.Provide(
graphql.NewGraphqlHandler,
newGraphqlHandler,
),
)
6 changes: 1 addition & 5 deletions pkg/router/chi/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var Module = fx.Options(
),
)

func startListener(lc fx.Lifecycle, s fx.Shutdowner, logger *zerolog.Logger, params router.Params, r *chi.Mux) {
func StartListener(lc fx.Lifecycle, s fx.Shutdowner, logger *zerolog.Logger, params router.Params, r *chi.Mux) {
server, listener, err := thunderChi.CreateServer(params.Handlers, logger, r)
if err != nil {
logger.Error().Err(err).Msg("failed to create server")
Expand Down Expand Up @@ -62,7 +62,3 @@ func startListener(lc fx.Lifecycle, s fx.Shutdowner, logger *zerolog.Logger, par
},
)
}

var StartServer = fx.Invoke(
startListener,
)

0 comments on commit e2d60bf

Please sign in to comment.