FriendsOfSymfony / FOSJsRoutingBundle

A pretty nice way to expose your Symfony routing to client applications.
1.48k stars 261 forks source link

modify dump command to generate export call in js routes file. #479

Open alexbaron opened 6 months ago

alexbaron commented 6 months ago

is it possible to update the command DumpCommand to be able to generate the js routes content as follow :

const routesConfig = {
    "base_url": "",
    "routes":
    {
        "route name": {
          ....
        }
    },
    "prefix": "",
    "host": "localhost",
    "port": "", "scheme":
        "http",
    "locale": ""
};

export default routesConfig;

I tried to use callback without success.

My goal is to be able to use fosjsrouting in assetmapper as follow :

import Routing from 'fos-routing';
import routerConfig from './routing/fos_js_routes.js';
Routing.setData(routerConfig);