Skip to content

Commit

Permalink
create alias for Module
Browse files Browse the repository at this point in the history
  • Loading branch information
janishar committed Jun 24, 2024
1 parent ac1e2d4 commit 22618d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion startup/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/unusualcodeorg/goserve/config"
)

type Module network.Module[module]

type module struct {
Context context.Context
Env *config.Env
Expand Down Expand Up @@ -60,7 +62,7 @@ func (m *module) AuthorizationProvider() network.AuthorizationProvider {
return authMW.NewAuthorizationProvider()
}

func NewModule(context context.Context, env *config.Env, db mongo.Database, store redis.Store) network.Module[module] {
func NewModule(context context.Context, env *config.Env, db mongo.Database, store redis.Store) Module {
userService := user.NewService(db)
authService := auth.NewService(db, env, userService)
blogService := blog.NewService(db, store, userService)
Expand Down
2 changes: 1 addition & 1 deletion startup/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Server() {
router.Start(env.ServerHost, env.ServerPort)
}

func create(env *config.Env) (network.Router, network.Module[module], Shutdown) {
func create(env *config.Env) (network.Router, Module, Shutdown) {
context := context.Background()

dbConfig := mongo.DbConfig{
Expand Down
2 changes: 1 addition & 1 deletion startup/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type Teardown = func()

func TestServer() (network.Router, network.Module[module], Teardown) {
func TestServer() (network.Router, Module, Teardown) {
env := config.NewEnv("../.test.env")
router, module, shutdown := create(env)
ts := httptest.NewServer(router.GetEngine())
Expand Down

0 comments on commit 22618d7

Please sign in to comment.