mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 02:47:04 +00:00
add a new 'overview' MVC example
Former-commit-id: f73cbf6010595c639f6c5b5119e2ec41bc9802a5
This commit is contained in:
23
_examples/mvc/overview/controller/greet_controller.go
Normal file
23
_examples/mvc/overview/controller/greet_controller.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"app/model"
|
||||
"app/service"
|
||||
)
|
||||
|
||||
// GreetController handles the index.
|
||||
type GreetController struct {
|
||||
Service service.GreetService
|
||||
// Ctx iris.Context
|
||||
}
|
||||
|
||||
// Get serves [GET] /.
|
||||
// Query: name
|
||||
func (c *GreetController) Get(req model.Request) (model.Response, error) {
|
||||
message, err := c.Service.Say(req.Name)
|
||||
if err != nil {
|
||||
return model.Response{}, err
|
||||
}
|
||||
|
||||
return model.Response{Message: message}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user