
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@imax.i7/express-timeout
Advanced tools
express-timeout
is a middleware for Express.js that adds timeout functionality to your routes. With this middleware, you can easily set a timeout for specific routes, ensuring that requests that take too long are automatically terminated.
npm install @imax.i7/express-timeout
const express = require("express");
const { RateLimitMiddleware } = require("@imax.i7/express-timeout");
const app = express();
app.use((req, res, next) =>
RateLimitMiddleware({
content: {
error: "The user is now on a timeout.",
req,
res,
next,
},
})
);
app.listen(3000, () => {
console.log("Server is running on port 3000");
});
You can customize the timeout duration and handle the timeout event.
// Customize timeout duration (10 seconds) and handle timeout event
app.use((req, res, next) =>
RateLimitMiddleware({
req,
res,
next,
onTimeout: handleTimeout,
})
);
function handleTimeout(req, res) {
res.status(503).send("Request timed out");
}
Make sure to place the @imax.i7/express-timeout
middleware before your route handlers to ensure it takes effect.
Contributions are welcome! Please feel free to submit a pull request or open an issue.
ISC
FAQs
A express middleware for handling spam requests.
We found that @imax.i7/express-timeout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
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.