module_some.go 890 B

12345678910111213141516171819202122232425262728
  1. package modules
  2. import (
  3. "fmt"
  4. "net/http"
  5. "golang-fave/engine/wrapper"
  6. )
  7. func (this *Modules) RegisterModule_Some() *Module {
  8. return this.newModule(MInfo{
  9. WantDB: false,
  10. Mount: "some",
  11. Name: "Some Module",
  12. }, func(wrap *wrapper.Wrapper) {
  13. fmt.Printf("SOME FrontEnd func call\n")
  14. wrap.W.WriteHeader(http.StatusOK)
  15. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  16. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  17. wrap.W.Write([]byte(`SOME FrontEnd func call (` + wrap.CurrModule + `)`))
  18. }, func(wrap *wrapper.Wrapper) {
  19. fmt.Printf("SOME BackEnd func call\n")
  20. wrap.W.WriteHeader(http.StatusOK)
  21. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  22. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  23. wrap.W.Write([]byte(`SOME BackEnd func call (` + wrap.CurrModule + `)`))
  24. })
  25. }