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 "gitlab.com/mokhax/sparkled/pkg/web"
11)
12
13func New() http.Handler {
14 mux := ioc.MustResolve[*http.ServeMux](ioc.Default)
15
16 mountable := []web.Mountable{
17 sparkles.New(ioc.MustResolve[db.Repository](ioc.Default)),
18 health.New(),
19 }
20 for _, m := range mountable {
21 m.MountTo(mux)
22 }
23
24 mux.Handle("GET /", http.FileServer(http.Dir("public")))
25
26 return mux
27}