From 5ee1df2439ae6cb7fce7fa778a9bf2fd4b0c5e08 Mon Sep 17 00:00:00 2001 From: Lambert Beekhuis Date: Thu, 15 Feb 2018 12:23:24 +0100 Subject: [PATCH] Documenation: update usage.rst Add documentation on how to dump correct routes from the console command --- Resources/doc/usage.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Resources/doc/usage.rst b/Resources/doc/usage.rst index 00bead3d..315ff26b 100644 --- a/Resources/doc/usage.rst +++ b/Resources/doc/usage.rst @@ -37,6 +37,16 @@ instead of ``web``, to achieve this you can set the ``target`` parameter: # Symfony Flex bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json +When you dump the routes from a command, the Request Context (e.g. host and base_url) are not known. To generate correct routes for each environment with console commands, add the following (see `How to Generate URLs from the Console`): + +.. code-block:: yaml + + # app/config/config_dev.yml (Symfony 3) + parameters: + router.request_context.host: "yourhost" + router.request_context.scheme: "http" + router.request_context.base_url: "/app_dev.php" + Then within your JavaScript development you can use: .. code-block:: javascript