module_index.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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: true,
  9. Mount: "index",
  10. Name: "Pages",
  11. }, func(wrap *wrapper.Wrapper) {
  12. // Front-end
  13. wrap.W.WriteHeader(http.StatusOK)
  14. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  15. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  16. wrap.W.Write([]byte(`INDEX FrontEnd func call (` + wrap.CurrModule + `)`))
  17. }, func(wrap *wrapper.Wrapper) {
  18. // Back-end
  19. wrap.W.WriteHeader(http.StatusOK)
  20. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  21. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  22. wrap.W.Write([]byte(`INDEX BackEnd func call (` + wrap.CurrModule + `)`))
  23. })
  24. }
  25. func (this *Modules) RegisterAction_MysqlSetup() *Action {
  26. return this.newAction(AInfo{
  27. WantDB: false,
  28. Mount: "mysql",
  29. }, func(wrap *wrapper.Wrapper) {
  30. // wrap.MsgError(`Install`)
  31. })
  32. }
  33. // All actions here...
  34. // MySQL install
  35. // MySQL first user
  36. // User login
  37. // User logout