-
Notifications
You must be signed in to change notification settings - Fork 43
Mvc Controller
YoyoFx edited this page Jul 23, 2020
·
3 revisions
type UserController struct {
Mvc.ApiController
userAction models.IUserAction
}
func NewUserController(userAction models.IUserAction) *UserController {
return &UserController{userAction: userAction}
}
func (controller UserController) GetInfo() Mvc.ApiResult {
return controller.OK(controller.userAction.Login("zhang"))
}
package main
import ...
func main() {
YoyoGo.NewWebHostBuilder().
SetEnvironment(Context.Prod).
UseFastHttp().
Configure(func(app *YoyoGo.WebApplicationBuilder) {
app.UseMvc(func(builder *Mvc.ControllerBuilder) {
builder.AddController(contollers.NewUserController)
})
}).Build().Run()
}