summaryrefslogtreecommitdiffstats
path: root/lib/public/appframework
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-11-27 01:55:52 -0800
committerMorris Jobke <morris.jobke@gmail.com>2013-11-27 01:55:52 -0800
commita81909097c57c759274290a5a5fac908b909d3ae (patch)
tree371da5ff23eb3126ad6a7952294d7845dfb9717a /lib/public/appframework
parent34704eded68c8b8bbd9d19364875d6abc1827433 (diff)
parent7755e69af0fea0925afacd7b038b792b9fb0e3e1 (diff)
downloadnextcloud-server-a81909097c57c759274290a5a5fac908b909d3ae.tar.gz
nextcloud-server-a81909097c57c759274290a5a5fac908b909d3ae.zip
Merge pull request #6027 from owncloud/public-api-restful-routing-oc6
fix appframework routing
Diffstat (limited to 'lib/public/appframework')
-rw-r--r--lib/public/appframework/app.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php
index 0ff6648c5d4..90150245c41 100644
--- a/lib/public/appframework/app.php
+++ b/lib/public/appframework/app.php
@@ -26,6 +26,7 @@
*/
namespace OCP\AppFramework;
+use OC\AppFramework\routing\RouteConfig;
/**
@@ -53,6 +54,28 @@ class App {
}
/**
+ * This function is to be called to create single routes and restful routes based on the given $routes array.
+ *
+ * Example code in routes.php of tasks app (it will register two restful resources):
+ * $routes = array(
+ * 'resources' => array(
+ * 'lists' => array('url' => '/tasklists'),
+ * 'tasks' => array('url' => '/tasklists/{listId}/tasks')
+ * )
+ * );
+ *
+ * $a = new TasksApp();
+ * $a->registerRoutes($this, $routes);
+ *
+ * @param \OC_Router $router
+ * @param array $routes
+ */
+ public function registerRoutes($router, $routes) {
+ $routeConfig = new RouteConfig($this->container, $router, $routes);
+ $routeConfig->register();
+ }
+
+ /**
* This function is called by the routing component to fire up the frameworks dispatch mechanism.
*
* Example code in routes.php of the task app: