diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-12 18:11:05 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-12 18:11:05 -0600 |
| commit | 0bef608297d7def2a18d054e7230fe0e0a3710a7 (patch) | |
| tree | 93a8ec34baa695705832ace22266e1f13cb9e64e /app/init.go | |
| parent | 54715831a2d307390c05214b6ae8bc721ade6680 (diff) | |
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() + }) +} |
