module_index.go 1012 B

123456789101112131415161718192021222324252627282930313233
  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(false, "index", "Pages", func(wrap *wrapper.Wrapper) {
  8. wrap.W.WriteHeader(http.StatusOK)
  9. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  10. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  11. wrap.W.Write([]byte(`INDEX FrontEnd func call (` + wrap.CurrModule + `)`))
  12. }, func(wrap *wrapper.Wrapper) {
  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 BackEnd func call (` + wrap.CurrModule + `)`))
  17. })
  18. }
  19. func (this *Modules) RegisterAction_MysqlSetup() *Action {
  20. return this.newAction(false, "mysql", func(wrap *wrapper.Wrapper) {
  21. wrap.MsgError(`Some error`)
  22. })
  23. }
  24. // All actions here...
  25. // MySQL install
  26. // MySQL first user
  27. // User login
  28. // User logout