app.go 883 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package feed
  2. import (
  3. "net/http"
  4. "github.com/cryptix/go/http/render"
  5. "github.com/cryptix/go/logging"
  6. "github.com/gorilla/mux"
  7. "github.com/cryptix/exp/multiModulePage/router"
  8. )
  9. var HTMLTemplates = []string{
  10. "/feed/overview.tmpl",
  11. "/feed/post.tmpl",
  12. }
  13. var l = logging.Logger("webApp/archive")
  14. /*
  15. type FeedPage struct{}
  16. func (fp FeedPage) GetTemplates() []string {
  17. return HTMLTemplates
  18. }
  19. type Pages interface {
  20. SetRenderer(*render.Renderer)
  21. GetTemplates() []string
  22. Handler(*mux.Router)
  23. }
  24. var _ Pages = FeedPage{}
  25. */
  26. // Handler creates a http.Handler with all the archives routes attached to it
  27. func Handler(m *mux.Router, r *render.Renderer) http.Handler {
  28. if m == nil {
  29. m = router.FeedApp(nil)
  30. }
  31. m.Get(router.FeedOverview).Handler(r.HTML("/feed/overview.tmpl", showOverview))
  32. m.Get(router.FeedPost).Handler(r.HTML("/feed/post.tmpl", showPost))
  33. return m
  34. }