
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
summon-middleware
Advanced tools
This wrapper allows you to dynamically enable or disable an express or connect middleware or an array of them. In some circumstances you would use one or more middlewares only if some conditions are met.
If you want to use summon-middleware you have to install it. There are two methods to do that:
In your package.json add the following item for the latest version:
"summon-middleware": "*"
or, if you want a specific version, just add an item like the following, specifying the version number:
"summon-middleware": "2.0.2"
then launch this command:
npm install
Just launch this command:
npm install summon-middleware --save
summonMiddleware(middleware, predicate)
middleware
{Function|Function[]} an express or connect middleware or an
array of them.predicate
{Function} a function that returns a boolean value
and that represents the condition for which the provided middlewares
have to be used or not.If the parameters' type does not match with those required, an error will be thrown. In pariticular, the error will be an instance of SummonMiddlewareError.
var summonMiddleware = require('summon-middleware')
var express = require('express')
var app = express()
var responsePoweredBy = require('response-powered-by')
var POWERED_BY = "@NickNaso"
app.use(summonMiddleware(responsePoweredBy(POWERED_BY), function () {
// some instructions...
if (<your condition>) {
return true
}
return false
}))
var summonMiddleware = require('summon-middleware')
var express = require('express')
var app = express()
var responsePoweredBy = require('response-powered-by')
var POWERED_BY = "@NickNaso"
var responseTime = require('response-time')
var myMiddlewares = [
responsePoweredBy(POWERED_BY),
responseTime()
]
app.use(summonMiddleware(myMiddlewares, function () {
// some instructions...
if (<your condition>) {
return true
}
return false
}))
FAQs
Dynamically enable or disable express middlewares
The npm package summon-middleware receives a total of 1 weekly downloads. As such, summon-middleware popularity was classified as not popular.
We found that summon-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.