Coder Social home page Coder Social logo

fos-routing's Introduction

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

fos-routing's People

Contributors

isychev avatar vlajos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fos-routing's Issues

Wrong route scheme: generated http instead https

My fos_js_routes_export.js looks like:

{
    "base_url":"",
    "prefix":"",
    "host":"localhost",
    "scheme":"http",
    "routes":{
        "login":{
           "tokens":[
              ["text", "\/login"]
           ],
           "defaults":[],
           "requirements":[],
           "hosttokens":[
              ["text", "localhost"]
           ],
           "methods":[],
           "schemes":["https"]
        },
    }
}

This route support https scheme only. But result of generation has http schema: http://localhost/login

help error

Hello,
he me but as error
line 17 exports is not defined which is:
exports ["router"] = (window.Routing)
Thank you in advance for your assistance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.