New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

koa-mount-pattern

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-mount-pattern

Mount other Koa middleware to a path. Accept both the regex path and pattern style path.

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
17
-41.38%
Maintainers
1
Weekly downloads
 
Created
Source

koa-mount-pattern

As you may know, there's a famous middleware called koa-mount which is used to mount a middleware to a specific path. But what if you want to mount a middleware to a path pattern? For example, you want to mount a middleware to all paths that start with /api/(v1|v2|v3)? This is where koa-mount-pattern comes in.

Installation

npm install koa-mount-pattern

Usage

const Koa = require('koa');
const { mountPattern } = require('koa-mount-pattern');

const app = new Koa();
app.use(mountPattern('/api/:version', async (ctx, next) => {
  // do something
  await next();
}));

FAQs

Package last updated on 09 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts