forked from ChicagoBoss/ChicagoBoss
-
Notifications
You must be signed in to change notification settings - Fork 0
Routes
kotedo edited this page Jul 26, 2012
·
3 revisions
The routing system is simple, in the file boss.routes you have some special routes and free-hand named routes, the routes are loaded at startup in memory (ets table) and reloaded on /admin/upgrade.
The file contains a list of erlang terms, one per line finished with a dot.
- boss.routes example
% Routes file.
% Formats:
% {"/some/route", [{controller, "Controller"}, {action, "Action"}]}.
% {"/some/route", [{controller, "Controller"}, {action, "Action"}, {id, "42"}]}.
% {"/(some|any)/route/(\\d+)", [{controller, '$1'}, {action, "Action"}, {id, '$2'}]}.
% {"/some/route/(?<route_id>\\d+)", [{controller, "Controller"}, {action, "Action"}, {id, '$route_id'}]}.
% {"/some/route", [{application, some_app}, {controller, "Controller"}, {action, "Action"}, {id, "42"}]}.
%
% {404, [{controller, "Controller"}, {action, "Action"}]}.
% {404, [{controller, "Controller"}, {action, "Action"}, {id, "42"}]}.
% {404, [{application, some_app}, {controller, "Controller"}, {action, "Action"}, {id, "42"}]}.
%
% Note that routing across applications results in a 302 redirect.
% Front page
% {"/", [{controller, "world"}, {action, "hello"}]}.
% 404 File Not Found handler
% {404, [{controller, "world"}, {action, "lost"}]}.
% 500 Internal Error handler (only invoked in production)
% {500, [{controller, "world"}, {action, "calamity"}]}.