news.go 440 B

12345678910111213141516171819202122
  1. package router
  2. import "github.com/gorilla/mux"
  3. // constant names for the named routes
  4. const (
  5. NewsOverview = "News:overview"
  6. NewsPost = "News:post"
  7. )
  8. // NewsApp constructs a mux.Router containing the routes for News html app
  9. func NewsApp(m *mux.Router) *mux.Router {
  10. if m == nil {
  11. m = mux.NewRouter()
  12. }
  13. m.Path("/").Methods("GET").Name(NewsOverview)
  14. m.Path("/News/{PostID:[0-9]+}").Methods("GET").Name(NewsPost)
  15. return m
  16. }