DotcomWeb.Router (MBTA Website v0.0.1)

View Source

Dotcom's router. A normal Phoenix router with a fairly large number of routes, which exist in order to support a large number of historical pages.

One quirk worth noting is that we have an all-purpose fallback. If a path doesn't resolve to any of our hard-coded routes, then it falls back to the DotcomWeb.CMSController. This means that the URL sigil ~p won't provide a warning if you get a path wrong, because in theory, that path could resolve to something in the CMS.

Summary

Functions

Callback invoked by Plug on every request.

A custom error handling function that renders the appropriate error page.

Callback required by Plug that initializes the router for serving web requests.

Functions

api(conn, _)

browser(conn, _)

browser_live(conn, _)

cached_daily(conn, _)

cached_hourly(conn, _)

call(conn, opts)

Callback invoked by Plug on every request.

formatted_routes(_)

Callback implementation for Phoenix.VerifiedRoutes.formatted_routes/1.

get_flags(conn, _)

handle_errors(conn, assigns)

A custom error handling function that renders the appropriate error page.

For most (unexpected) errors, we render a 500 page. When we see a DotcomWeb.NotFoundError, we render the 404 page instead.

init(opts)

Callback required by Plug that initializes the router for serving web requests.

secure(conn, _)

verified_route?(_, split_path)

Callback implementation for Phoenix.VerifiedRoutes.verified_route?/2.