{"id":18342,"library":"express-match-request","title":"express-match-request","description":"Express middleware for matching incoming requests (method + URL) to a pattern, commonly used to conditionally apply further middleware or route handlers. Latest version 0.1.3, released sporadically. Minimal utility with no dependencies; relies on Express's req.method and req.originalUrl for pattern matching. Not actively maintained, with only a few releases. Simpler than full-featured route-matching libraries like express-path-match or find-my-way, but may not support advanced patterns or wildcards.","status":"maintenance","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/webextensions/express-match-request","tags":["javascript","express","middleware","match","request","originalUrl"],"install":[{"cmd":"npm install express-match-request","lang":"bash","label":"npm"},{"cmd":"yarn add express-match-request","lang":"bash","label":"yarn"},{"cmd":"pnpm add express-match-request","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; designed as Express middleware","package":"express","optional":false}],"imports":[{"note":"Package exports a single function as default export. CommonJS users must use require('express-match-request').default or assign to a default import.","wrong":"const { matchRequest } = require('express-match-request')","symbol":"default","correct":"import matchRequest from 'express-match-request'"},{"note":"CommonJS require returns the default export directly as a function.","wrong":"import { matchRequest } from 'express-match-request'","symbol":"matchRequest","correct":"const matchRequest = require('express-match-request')"},{"note":"No named exports; only a default function. No type definitions provided.","wrong":null,"symbol":"Pattern","correct":"import matchRequest from 'express-match-request'"}],"quickstart":{"code":"import express from 'express';\nimport matchRequest from 'express-match-request';\n\nconst app = express();\n\n// Match requests to GET /api/users\napp.use(matchRequest('GET', '/api/users'), (req, res) => {\n  res.json({ message: 'Users endpoint' });\n});\n\n// Match all methods to /public\napp.use(matchRequest('*', '/public'), express.static('public'));\n\napp.listen(3000, () => console.log('Server running on port 3000'));","lang":"javascript","description":"Demonstrates using matchRequest as middleware to conditionally handle GET /api/users and serve static files on /public."},"warnings":[{"fix":"Use a library like express-path-match for parameterized routes.","message":"Pattern matching is simple equality, not RegExp or path-to-regexp. Complex patterns (e.g., '/users/:id') will not work as expected.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider alternatives like find-my-way or express-path-match.","message":"Library has not been updated in years; no TypeScript definitions or modern ESM support beyond basic CommonJS.","severity":"deprecated","affected_versions":">=0.1.3"},{"fix":"Ensure subsequent middleware handles non-matched methods correctly.","message":"If method is '*', it matches all HTTP methods (GET, POST, etc.) but does not distinguish. In Express, middleware order and next() semantics apply.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.1.3':28 'activ':47 'advanc':77 'appli':20 'common':16 'condit':19 'depend':35 'express':2,5,38,65,82 'express-match-request':1 'express-path-match':64 'featur':58 'find':70 'find-my-way':69 'full':57 'full-featur':56 'handler':25 'incom':9 'javascript':81 'latest':26 'librari':62 'like':63 'maintain':48 'match':3,8,45,61,67,84 'may':74 'method':11 'middlewar':6,22,83 'minim':31 'originalurl':86 'path':66 'pattern':15,44,78 'releas':29,53 'reli':36 'req.method':40 'req.originalurl':42 'request':4,10,85 'rout':24,60 'route-match':59 'simpler':54 'sporad':30 'support':76 'url':12 'use':17 'util':32 'version':27 'way':72 'wildcard':80","created_at":"2026-04-25T07:37:44.662393+00:00","updated_at":"2026-04-25T07:37:44.662393+00:00","problems":[{"fix":"Use default import: import matchRequest from 'express-match-request'","cause":"Using named import instead of default import in ESM (e.g., import { matchRequest } from 'express-match-request')","error":"TypeError: matchRequest is not a function"},{"fix":"Run: npm install express-match-request","cause":"Package not installed or incorrectly installed","error":"Cannot find module 'express-match-request'"},{"fix":"Ensure you pass method and pattern: app.use(matchRequest('GET', '/path'), handler)","cause":"matchRequest returns a function that must be used as middleware; if called without arguments it returns undefined","error":"matchRequest(...) is not a valid middleware"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/webextensions/express-match-request","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/express-match-request","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}