diff --git a/startup/module.go b/startup/module.go index 4127a16..fd5f0da 100644 --- a/startup/module.go +++ b/startup/module.go @@ -18,6 +18,8 @@ import ( "github.com/unusualcodeorg/goserve/config" ) +type Module network.Module[module] + type module struct { Context context.Context Env *config.Env @@ -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) diff --git a/startup/server.go b/startup/server.go index d3d78f1..b0374e9 100644 --- a/startup/server.go +++ b/startup/server.go @@ -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{ diff --git a/startup/testserver.go b/startup/testserver.go index a30bcf6..74246df 100644 --- a/startup/testserver.go +++ b/startup/testserver.go @@ -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())