module_index.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package modules
  2. import (
  3. "net/http"
  4. "golang-fave/engine/wrapper"
  5. )
  6. func (this *Modules) RegisterModule_Index() *Module {
  7. return this.newModule(MInfo{
  8. WantDB: false,
  9. Mount: "index",
  10. Name: "Pages",
  11. }, func(wrap *wrapper.Wrapper) {
  12. wrap.W.WriteHeader(http.StatusOK)
  13. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  14. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  15. wrap.W.Write([]byte(`INDEX FrontEnd func call (` + wrap.CurrModule + `)`))
  16. }, func(wrap *wrapper.Wrapper) {
  17. wrap.W.WriteHeader(http.StatusOK)
  18. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  19. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  20. wrap.W.Write([]byte(`INDEX BackEnd func call (` + wrap.CurrModule + `)`))
  21. })
  22. }
  23. func (this *Modules) RegisterAction_MysqlSetup() *Action {
  24. return this.newAction(AInfo{
  25. WantDB: false,
  26. Mount: "mysql",
  27. }, func(wrap *wrapper.Wrapper) {
  28. wrap.MsgError(`Some error`)
  29. })
  30. }
  31. // All actions here...
  32. // MySQL install
  33. // MySQL first user
  34. // User login
  35. // User logout