1.0.0 • Published 7 years ago

frontexpress-path-to-regexp v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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.