2
votes

I'm trying to route a subdomain to a rest route module essencially.

So far all I've been able to get working is routing the subdomain to the module with the correct route.

What I've got so far :

resources.router.routes.api.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.api.route = "api.mysite.dev"
resources.router.routes.api.defaults.module = "api"
resources.router.routes.api.chains.index.type = "Zend_Controller_Router_Route"
resources.router.routes.api.chains.index.route = "v0.1/:controller/:action/*"
resources.router.routes.api.chains.index.defaults.controller = "index"
resources.router.routes.api.chains.index.defaults.action = "index"

This works fine, in that if I go to http://api.mysite.dev/v0.1/ it correctly routes to the index controller of the api module. However I've had no success in routing to a Rest route.

I would have thought that this would be common practice.

1

1 Answers

0
votes

For anyone thats interested, this is what's working for me :

resources.router.routes.api-v010-hostname.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.api-v010-hostname.route = "api.mysite.dev"
resources.router.routes.api-v010-hostname.chains.api-v010-version.type = "Zend_Controller_Router_Route"
resources.router.routes.api-v010-hostname.chains.api-v010-version.route = "v0.1"
resources.router.routes.api-v010-hostname.chains.api-v010-version.chains.api-v010-rest.type = "Zend_Rest_Route"
resources.router.routes.api-v010-hostname.chains.api-v010-version.chains.api-v010-rest.defaults.module = "api-v010"

This successfully rest routes http://api.mysite.dev/v0.1/ to a module api-v010, however it doesn't assign the default controller to index. I've tried defining the default controller on the Zend_Controller_Router_Route but with no success. Bar that it works a treat.