34 lines
635 B
Go
Executable File
34 lines
635 B
Go
Executable File
package web
|
|
|
|
import (
|
|
"go.ipao.vip/atom"
|
|
"go.ipao.vip/atom/container"
|
|
"go.ipao.vip/atom/contracts"
|
|
"go.ipao.vip/atom/opt"
|
|
)
|
|
|
|
func Provide(opts ...opt.Option) error {
|
|
if err := container.Container.Provide(func() (*WebController, error) {
|
|
obj := &WebController{}
|
|
|
|
return obj, nil
|
|
}); err != nil {
|
|
return err
|
|
}
|
|
if err := container.Container.Provide(func(
|
|
webController *WebController,
|
|
) (contracts.HttpRoute, error) {
|
|
obj := &Routes{
|
|
webController: webController,
|
|
}
|
|
if err := obj.Prepare(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return obj, nil
|
|
}, atom.GroupRoutes); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|