fmt

Gerasimos (Makis) Maropoulos 2019-07-23 17:50:35 +03:00
parent 1b81171353
commit 620f77c42e
No known key found for this signature in database
GPG Key ID: F169457BBDA4ACF4

11
MVC.md

@ -46,7 +46,8 @@ type MyController struct {}
func (m *MyController) BeforeActivation(b mvc.BeforeActivation) {
// 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
// 2-> Path
@ -56,10 +57,14 @@ func (m *MyController) BeforeActivation(b mvc.BeforeActivation) {
}
// 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}
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)