main
1package app
2
3import (
4 "net/http"
5
6 "github.com/xlgmokha/x/pkg/ioc"
7 "gitlab.com/mokhax/sparkled/app/controllers/health"
8 "gitlab.com/mokhax/sparkled/app/controllers/sparkles"
9 "gitlab.com/mokhax/sparkled/pkg/db"
10)
11
12func init() {
13 ioc.RegisterSingleton[db.Repository](ioc.Default, func() db.Repository {
14 return db.NewRepository()
15 })
16 ioc.RegisterSingleton[*http.ServeMux](ioc.Default, func() *http.ServeMux {
17 return http.NewServeMux()
18 })
19 ioc.Register[*sparkles.Controller](ioc.Default, func() *sparkles.Controller {
20 return sparkles.New(ioc.MustResolve[db.Repository](ioc.Default))
21 })
22 ioc.Register[*health.Controller](ioc.Default, func() *health.Controller {
23 return health.New()
24 })
25}