app.go 785 B

123456789101112131415161718192021222324252627282930313233343536
  1. package app
  2. import (
  3. "html/template"
  4. "git.clearsky.net.au/cody/gex.git/app/route/home"
  5. "git.clearsky.net.au/cody/gex.git/pkg/render"
  6. "git.clearsky.net.au/cody/gex.git/pkg/sec"
  7. "git.clearsky.net.au/cody/gex.git/pkg/sess"
  8. "git.clearsky.net.au/cody/gex.git/pkg/gen"
  9. "git.clearsky.net.au/cody/gex.git/pkg/srv"
  10. )
  11. func Init() {
  12. gen.GeneratePages("app")
  13. render.Include = func(req *srv.Req, props render.Props, funcs render.Funcs) {
  14. props["Sess"] = req.Ctx["Sess"]
  15. funcs["Cody"] = func() template.HTML {
  16. return "GO Fuck yourself"
  17. }
  18. }
  19. }
  20. func Middleware() {
  21. srv.AddMiddleware(sess.Middleware)
  22. srv.AddMiddleware(sec.Middleware)
  23. }
  24. func Routes() {
  25. type roles []string
  26. sec.Route("/{$}", roles{"Everyone"}, home.Index)
  27. }
  28. // props and funcs to include with every render