All Projects → mswjs → node-match-path

mswjs / node-match-path

Licence: other
Matches a URL against a path. Parameters, wildcards, RegExp.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-match-path

mswjs.io
Official website and documentation for the Mock Service Worker library.
Stars: ✭ 77 (+156.67%)
Mutual labels:  match, routing, request
url-trailing-slash
Allows enforcing URL routes with or without trailing slash
Stars: ✭ 35 (+16.67%)
Mutual labels:  url, routing, route
path-to-regexp-php
PHP port of https://github.com/pillarjs/path-to-regexp
Stars: ✭ 21 (-30%)
Mutual labels:  routing, path, route
golgi
A composable routing library for Haxe.
Stars: ✭ 37 (+23.33%)
Mutual labels:  url, routing
regXwild
⏱ Superfast ^Advanced wildcards++? | Unique algorithms that was implemented on native unmanaged C++ but easily accessible in .NET via Conari (with caching of 0x29 opcodes +optimizations) etc.
Stars: ✭ 20 (-33.33%)
Mutual labels:  match, wildcard
seenreq
Generate an object for testing if a request is sent, request is Mikeal's request.
Stars: ✭ 42 (+40%)
Mutual labels:  url, request
koii
A simple middleware for displaying routes in an express application
Stars: ✭ 73 (+143.33%)
Mutual labels:  routing, route
wumpfetch
🚀🔗 A modern, lightweight, fast and easy to use Node.js HTTP client
Stars: ✭ 20 (-33.33%)
Mutual labels:  url, request
github-base
Simple, opinionated node.js interface for creating basic apps with the GitHub API.
Stars: ✭ 58 (+93.33%)
Mutual labels:  url, request
Ffrouter
Powerful and easy-to-use URL routing library in iOS that supports URL Rewrite(强大、易用、支持 URL Rewrite的 iOS 路由库)
Stars: ✭ 263 (+776.67%)
Mutual labels:  url, routing
React Easy Params
🔗 Auto synchronize your state with the URL and LocalStorage.
Stars: ✭ 73 (+143.33%)
Mutual labels:  url, routing
Bidi
Bidirectional URI routing
Stars: ✭ 941 (+3036.67%)
Mutual labels:  url, routing
Djurl
Simple yet helpful library for writing Django urls by an easy, short and intuitive way.
Stars: ✭ 85 (+183.33%)
Mutual labels:  url, routing
url
Build and parse URLs. Useful for HTTP and "routing" in single-page apps (SPAs)
Stars: ✭ 69 (+130%)
Mutual labels:  url, routing
Swiftuirouter
Routing in SwiftUI
Stars: ✭ 242 (+706.67%)
Mutual labels:  routing, path
http
Aplus Framework HTTP Library
Stars: ✭ 113 (+276.67%)
Mutual labels:  url, request
vue-error-page
[NO LONGER MAINTAINED] Provides a wrapper for router-view that allows you to show error pages without changing the URL.
Stars: ✭ 52 (+73.33%)
Mutual labels:  routing, route
STCRouter
基于标准URL的iOS路由系统,可实现业务模块组件化,控制器之间零耦合,可实现黑白名单控制,可进行native降级到hybrid。
Stars: ✭ 19 (-36.67%)
Mutual labels:  routing, route
r2
A minimalist HTTP request routing helper for Go.
Stars: ✭ 32 (+6.67%)
Mutual labels:  routing, request
Django Multiurl
Have you ever wanted multiple views to match to the same URL? Now you can.
Stars: ✭ 268 (+793.33%)
Mutual labels:  url, routing

Package version

node-match-path

Matches a URL against the given path.

Getting started

Install

npm install node-match-path

Usage

const { match } = require('node-match-path')

match('/user/:userId', '/user/5')
/*
{
  matches: true,
  params: {
    userId: '5'
  }
}
*/

API

match(path: RegExp | string, url: string): Match

Returns a match data, if any, between a url and a path.

String path

match('/admin', '/admin')

/*
{
  matches: true,
  params: null
}
*/

Path parameters

match('/admin/:messageId', '/admin/abc-123')

/*
{
  matches: true,
  params: {
    messageId: 'abc-123'
  }
}
*/

Wildcard

match('/user/*/inbox', '/user/abc-123/inbox')

/*
{
  matches: true,
  params: null
}
*/

Regular expression

match(/\/messages\/.+?\/participants/, '/messages/5/participants')

/*
{
  matches: true,
  params: null
}
*/

Honorable mentions

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].