module_some.go 849 B

123456789101112131415161718192021222324
  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(false, "some", "Some Module", func(wrap *wrapper.Wrapper) {
  9. fmt.Printf("SOME FrontEnd func call\n")
  10. wrap.W.WriteHeader(http.StatusOK)
  11. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  12. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  13. wrap.W.Write([]byte(`SOME FrontEnd func call (` + wrap.CurrModule + `)`))
  14. }, func(wrap *wrapper.Wrapper) {
  15. fmt.Printf("SOME BackEnd func call\n")
  16. wrap.W.WriteHeader(http.StatusOK)
  17. wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  18. wrap.W.Header().Set("Content-Type", "text/html; charset=utf-8")
  19. wrap.W.Write([]byte(`SOME BackEnd func call (` + wrap.CurrModule + `)`))
  20. })
  21. }