Routes Overview

Routes are declared through the interfaces provided by the Route class. HotMelt will automatically load Site/routes.php, so you should use that file to declare routes.

<?php
\HotMelt\Route::add('/^\/$/', 'MySite\\Blog::index', 'Index.html');
\HotMelt\Route::add('/^new-post$/', 'MySite\\Blog::newPost', 'NewPostEditor.html');
// This is the target of the post editor form in NewPostEditor.html.
// It only accepts POST requests.
\HotMelt\Route::add('/^new-post$/', 'MySite\\Blog::newPost', 'NewPostEditor.html', 'POST');

Route::add() takes these arguments:

Pass null for the $action parameter and HotMelt will use a default action implementation (as returned by HotMelt\Action::defaultAction()). This can be useful if you want to render a template for a route that does not require any action level processing.

Routes are evaluated in the order they have been declared in. If you want to define the same options for multiple routes, you can bracket these in calls to Route::pushDefaultOptions() and Route::popDefaultOptions().