jdesrosiers / silex-cors-provider

A silex service provider that adds CORS services to silex
MIT License
78 stars 25 forks source link

Cannot get to work inside a ControllerProviderInterface implemented Class #29

Closed mangopop closed 8 years ago

mangopop commented 8 years ago

Hi, I might be doing something wrong here but I'm trying to get it working like this

public function connect(Application $app){
    $factory = $app['controllers_factory'];
    $factory->post('/', 'Classes\Routes\FaqsController::create');
    $factory->after($app["cors"]);
}

I can get it working on normal routes, just not one inside the controllers_factory I've created.

I'm getting this error Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "OPTIONS /faqs" (from "http://localhost:3000/") (uncaught exception) at /media/sf_localhost/dev.api.nitritex.com/vendor/symfony/http-kernel/EventListener/RouterListener.php line 159 {"exception":"[object](Symfony\Component\HttpKernel\Exception\NotFoundHttpException%28code: 0%29: No route found for "OPTIONS /faqs" %28from "http://localhost:3000/"%29 at /media/sf_localhost/dev.api.nitritex.com/vendor/symfony/http-kernel/EventListener/RouterListener.php:159, Symfony\Component\Routing\Exception\ResourceNotFoundException%28code: 0%29: No routes found for "/faqs". at /media/sf_localhost/dev.api.nitritex.com/vendor/symfony/routing/Matcher/UrlMatcher.php:102)"} []

Apologies if this is the wrong place to post this.

jdesrosiers commented 8 years ago

Unfortunately, this is a known bug: https://github.com/jdesrosiers/silex-cors-provider/issues/20. You can see the workaround I posted there. I never got around to implementing a permanent solution.