Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Repository files navigation

Caution

This repository is archived and no longer actively maintained.

We are no longer accepting issues, feature requests, or pull requests. For additional support or questions, please visit the Express.js Discussions page.

path match

NPM versionNode.js CIcodecovDependency StatusLicenseDownloads

Thin wrapper around path-to-regexp to make extracting the param names easier.

varroute=require('path-match')({// path-to-regexp optionssensitive: false,strict: false,end: false,});// create a match function from a routevarmatch=route('/post/:id');// match a routevarparse=require('url').parse;require('http').createServer(function(req,res){varparams=match(parse(req.url).pathname);// no matchif(params===false){res.statusCode=404;res.end();return;}// the matched idvarid=params.id;// do stuff with the ID})

About

please use path-to-regexp's `match` function

Resources

Code of conduct

Security policy

Stars

136 stars

Watchers

6 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages