Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/isychev/fos-routing
es6 library for client generate path from symfony2 routing
https://github.com/isychev/fos-routing
fos fosjsrouting fosjsroutingbundle fosrouting js routing symfony symfony2
Last synced: 2 months ago
JSON representation
es6 library for client generate path from symfony2 routing
- Host: GitHub
- URL: https://github.com/isychev/fos-routing
- Owner: isychev
- Created: 2017-06-15T09:01:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-16T08:06:41.000Z (almost 6 years ago)
- Last Synced: 2024-10-06T10:10:32.119Z (3 months ago)
- Topics: fos, fosjsrouting, fosjsroutingbundle, fosrouting, js, routing, symfony, symfony2
- Language: JavaScript
- Homepage:
- Size: 30.3 KB
- Stars: 10
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fos-routing
es6 library for client generate path from symfony2 routing### Installing
```javascript
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
```js
// 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
```js
// 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 |