diff options
Diffstat (limited to 'app/init.go')
| -rw-r--r-- | app/init.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/init.go b/app/init.go new file mode 100644 index 0000000..e48713d --- /dev/null +++ b/app/init.go @@ -0,0 +1,25 @@ +package app + +import ( + "net/http" + + "github.com/xlgmokha/x/pkg/ioc" + "gitlab.com/mokhax/sparkled/app/controllers/health" + "gitlab.com/mokhax/sparkled/app/controllers/sparkles" + "gitlab.com/mokhax/sparkled/pkg/db" +) + +func init() { + ioc.RegisterSingleton[db.Repository](ioc.Default, func() db.Repository { + return db.NewRepository() + }) + ioc.RegisterSingleton[*http.ServeMux](ioc.Default, func() *http.ServeMux { + return http.NewServeMux() + }) + ioc.Register[*sparkles.Controller](ioc.Default, func() *sparkles.Controller { + return sparkles.New(ioc.MustResolve[db.Repository](ioc.Default)) + }) + ioc.Register[*health.Controller](ioc.Default, func() *health.Controller { + return health.New() + }) +} |
