Coder Social home page Coder Social logo

finger's People

Contributors

golyshevd avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

golyshevd seiies

finger's Issues

Feature: Implement query decalaration

Rule pattern should support query arguments declaration.

Every query argument may be optional or required.

One optional argument:

/?foo

One required argument:

/&foo

Query declaration should support any number of argument declarations:

/&foo&bar?baz?zot

Query declaration should support same argument declaration with different options

/&foo?foo

Query declaration should support quantifiers for arguments

/&foo+?bar+

Query arguments declarations should support same syntax as path arguments

/&Number:id?{\\w+}:tag+

Query declaration should can be omitted and all the arguments should be parsed

/?

support query strings in patterns

support the ability to create different routes for patterns / and /?foo=bar
it should affect to matching result: url query must contain all the pattern query parameters

Support for baseUrl

var router = new Router({
    baseUrl: '/site/'
});

router.addRule('GET /news', {name: 'news'});

router.findMatches('/site/news'); // -> ok

router.getRule('news').build(); // -> /site/news

Think about ?* support

/news/(<postId>/)?feedId?*

?* - should extend args with all extra parsed query arguments when matching and should extendquerystring with all extra passed values when building

/news/?*

Handy to provide back compatibility with 0.3 but hard to implement and could make matching and building a little bit slower

2.0.0

  • Implement query parameters describing #87
  • Make Router main package module. Expose Rule, Matcher as static members of Router, document Router
  • Support common types #89

Support common types

Number \d+
Alnum \w+
Path [^?&]+?
String [\s\S]+
Ident [a-zA-Z]\w*(?:-[a-zA-Z]\w*)*
Segment [^?&]+?

Переименовать buildUrl в buildPath

Во избежание недоразумений. Path и Query кодируются похожим образом, но некоторые части урла кодируются по-другому

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.