Skip to content

es6 library for client generate path from symfony2 routing

Notifications You must be signed in to change notification settings

isychev/fos-routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Ilya SychevIlya Sychev
Ilya Sychev
and
Ilya Sychev
Jan 16, 2019
bb23a79 · Jan 16, 2019

History

19 Commits
Jan 16, 2019
Jan 15, 2019
Jun 15, 2017
Jun 15, 2017
Jun 15, 2017
Jun 15, 2017
Jan 16, 2019
Jan 9, 2019

Repository files navigation

fos-routing

es6 library for client generate path from symfony2 routing

Installing

npm install fos-routing --save

Usage

To work with Symfony2, you need to generate a js or json file with paths with fos:js-routing

php bin/console fos:js-routing:dump --callback="module.exports = " --target="any_custom_path || web/dist/fos_js_routes_export.js"

The --target parameter is made, for example, it can be any

Then, you should connect the newly created file in fos-routing

// myRouting.js
// import library fos-rouging
import Routing from 'fos-routing';
// import file with routes data
import RoutingData from 'path_to_folder_when_generate_file_with_routing_data || /web/dist/fos_js_routes_export';

// set data
Routing.setData(RoutingData);

// export library
export default Routing;

In the main project

// In the main project
import Routing from 'path_to_myRouting.js';

console.log(Routing.generate('demo_path'));

forRouting Methods

Method Params Description
setData data:Array Set data
generate 1. routing_name: String 2.params:Object of params Generate routing by routing_name with params, return string