Skip to content

A Java Port of the Express Routing Library 'path-to-regexp'

License

Notifications You must be signed in to change notification settings

mmcguill/express-routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Java Port of the Express Routing Library 'path-to-regexp'

A port of: https://www.npmjs.com/package/path-to-regexp

A Library to allow matching and parameter extraction from a URL based on an Express style route definition.

Example Usage:
@Test
public void test() {
    String routeDefinition = "/:commoditySlug/options/:optionId";
    final String path      = "/porkbelly/options/1234";

    ExpressRoute route = new ExpressRoute(routeDefinition);
    
    if (route.matches(path)) {
        final Map<String, String> parametersFromPath = route.getParametersFromPath(path);

        System.out.println(parametersFromPath);
    }
}
Other Features

There are many more examples in the Unit Tests, which you can use to guide your own developments.

About

A Java Port of the Express Routing Library 'path-to-regexp'

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages