How to update your FosJsRoutingBundle routes file

When you add a new route to one of your Symfony API routes aka your controllers, you will need to recreate the JSON routing file that FosJsRoutingBundle uses.

To do that you use this simple command.

php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json

This command will rewrite your existing routes JSON file located in the public folder of your project.

Then to make sure your routes are working you display them with this command.

php bin/console fos:js-routing:debug

This will output your currently available routes created with the line above.
To learn more about the command read this short article. How to view Symfony 5+ FosJsRoutingBundle routes

To learn how to get the Javascript routes in your javascript code in the first place with FosJsRoutingBundle read this book I wrote on the subject. LOL How to get URL Routes in your Javascript in Symfony 5+


Posted

in

by

Tags:

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d