From dae36c2aa4afebb38cc3235b46c6490b2f771aa1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 11 Nov 2008 06:18:45 +0000 Subject: Create REST_Controller abstract base class for all REST based resource controllers. Any controller that wants to act RESTful can extend this class and implement get/post/put/delete. Tweak default routes to disallow direct access to the REST controller and direct access to any REST methods. --- core/config/routes.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/config/routes.php') diff --git a/core/config/routes.php b/core/config/routes.php index 5c34acb7..9b958df1 100644 --- a/core/config/routes.php +++ b/core/config/routes.php @@ -17,5 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +// REST configuration +// Any resource requests (eg: album/1 or comment/3) get dispatched to the REST +// dispatcher. Any direct calls to REST methods are also forced into the dispatcher +// since the REST methods are internally expecting an ORM, not an id. +$config['^rest'] = null; +$config['^rest/.*'] = null; $config['^(\w+)/(\d+)$'] = '$1/dispatch/$2'; +$config['^(\w+)/(?:get|post|put|delete)/(\d+)$'] = '$1/dispatch/$2'; + +// For now our default page is the scaffolding. $config['_default'] = 'welcome'; -- cgit v1.2.3