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
You must log in to post a comment.