-
Notifications
You must be signed in to change notification settings - Fork 263
Empty routes #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Did you expose your routes ? |
I to have empty routres ! What do you mean expose ? I do not see anywhere in the documentation telling that you need to expose your routes |
I do not remember, removed package and developed own -_ - Maybe will try someday again. |
Same here. fos_js_routes.json just returns with
|
XML also supports importing other resources: https://symfony.com/doc/current/routing/external_resources.html |
Think I find the solution: Ok, I think I found the problem. Here it is: Checking how the FOSJsRoutingBundle works, I found the ExposedRoutesExtractor.php , that checks if "isRouteExposed" on "getRoutes()" method. I found that I needed to expose my routes by setting the 'exposed' = true option on the @route, like this:
But, even after that, FOSJsRoutingBundle continues not showing anyone. In this Issue FriendsOfSymfony/FOSRestBundle#718 they said that routes defined by annotations (FOSRest routes???) was not caught by this ExposedRoutesExtractor, only if they were exposed in yaml. So I dit it. On config/routes/annotations.yaml I added: controllers: Voila. php bin/console fos:js-routing:debug now shows all my routes. |
Thanks @carlospauluk for finding this! I had the same issue. However, With that static config approach it works. Which is a bummer, because now all routes are exposed by default. But I can live with that :) |
Is it possible to expose routes while using yaml for routing definitions?
|
Yes it is, like this : your_route_name:
path: /path/{argument}
controller: App\Controller\YourController::yourAction
options:
expose: true
|
Thank you, my Google-Fu failed on me and couldn't find a single thing in the docs :) |
I'm successfully exposing specific routes through their annotation:
Perhaps that means the issue @carlospauluk described is solved? I think the documentation needs to put more emphasis on the need to expose the routes, and the many ways to do it, right before Generating URIs. |
Maybe you forgot to dump the newly exposed routes ? I overlooked this after exposing a route. |
Symfony 4.0.8
All cache cleared.
Followed steps
https://symfony.com/doc/master/bundles/FOSJsRoutingBundle/index.html
I do not have
routing.yaml
in config/, it is replaced withroutes.xml
. It does not accept resource parameter for route. Ok. Createdrouting.yaml
, only for this package with single entry pointregistered bundle, added fos_js_routing.yaml in config/packages/ folder.
linked files
dumping php bin/console fos:js-routing:dump
or generatined with flex .json file are empty
routes.js
fos.Router.setData({"base_url":"","routes":[],"prefix":"","host":"custom.host.locc","scheme":"http"});
.json
{"base_url":"","routes":[],"prefix":"","host":"custom.host.locc","scheme":"http"}
parameters XML
Why so? What im doing wrong
The text was updated successfully, but these errors were encountered: