Skip to content
Frontexpress plugin to support Express-style path
JavaScript
Branch: master
Clone or download
Camel Aissani
Latest commit c950a26 Jul 9, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.babelrc
.codeclimate.yml
.eslintignore
.eslintrc
.gitignore
.travis.yml
LICENSE
README.md
frontexpress-path-to-regexp.js
frontexpress-path-to-regexp.min.js
frontexpress-path-to-regexp.min.js.map
gzipsize.js
index.js
package.json
rollup.config.dev.js
rollup.config.prod.js

README.md

frontexpress-path-to-regexp

Frontexpress plugin to support Express-style path string such as /user/:name.

Build Status Code Climate Coverage Status Size Shield

Installation

npm install frontexpress-path-to-regexp --save

Usage

import frontexpress from 'frontexpress';
import pathToRegexp from 'frontexpress-path-to-regexp';

// Front-end application
const app = frontexpress();

app.use(pathToRegexp);

// now all express-style path are supported :)
app.get('/:foo*', (req, res) => {
    document.querySelector('.content').innerHTML = res.responseText;
});

This plugin uses path-to-regexp for matching the route paths; see the path-to-regexp documentation for all the possibilities in defining route paths. The same library used in Express.

You can’t perform that action at this time.