frontend.go 603 B

123456789101112131415161718192021222324
  1. package engine
  2. import (
  3. "fmt"
  4. )
  5. func (this *Engine) FrontEnd() bool {
  6. if this.Wrap.R.URL.Path == "/" {
  7. this.Wrap.W.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
  8. this.Wrap.W.Header().Set("Content-Type", "text/html")
  9. counter := this.Wrap.S.GetInt("counter", 0)
  10. // this.Wrap.LogAccess(fmt.Sprintf("Counter value was: %d", counter))
  11. this.Wrap.W.Write([]byte(`Logic -> (` + fmt.Sprintf("%d", counter) + `)`))
  12. counter++
  13. this.Wrap.S.SetInt("counter", counter)
  14. // this.Wrap.LogAccess(fmt.Sprintf("Counter value now: %d", counter))
  15. return true
  16. }
  17. return false
  18. }