module_some.go 576 B

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