mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 15:06:26 +01:00
fmt
parent
1b81171353
commit
620f77c42e
11
MVC.md
11
MVC.md
|
@ -46,7 +46,8 @@ type MyController struct {}
|
||||||
|
|
||||||
func (m *MyController) BeforeActivation(b mvc.BeforeActivation) {
|
func (m *MyController) BeforeActivation(b mvc.BeforeActivation) {
|
||||||
// b.Dependencies().Add/Remove
|
// b.Dependencies().Add/Remove
|
||||||
// b.Router().Use/UseGlobal/Done // and any standard API call you already know
|
// b.Router().Use/UseGlobal/Done
|
||||||
|
// and any standard Router API call you already know
|
||||||
|
|
||||||
// 1-> Method
|
// 1-> Method
|
||||||
// 2-> Path
|
// 2-> Path
|
||||||
|
@ -56,10 +57,14 @@ func (m *MyController) BeforeActivation(b mvc.BeforeActivation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: http://localhost:8080/root
|
// GET: http://localhost:8080/root
|
||||||
func (m *MyController) Get() string { return "Hey" }
|
func (m *MyController) Get() string {
|
||||||
|
return "Hey"
|
||||||
|
}
|
||||||
|
|
||||||
// GET: http://localhost:8080/root/something/{id:long}
|
// GET: http://localhost:8080/root/something/{id:long}
|
||||||
func (m *MyController) MyCustomHandler(id int64) string { return "MyCustomHandler says Hey" }
|
func (m *MyController) MyCustomHandler(id int64) string {
|
||||||
|
return "MyCustomHandler says Hey"
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Persistence data inside your Controller struct (share data between requests)
|
Persistence data inside your Controller struct (share data between requests)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user