
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
Middleware magic ✨ for Express, Fastify & Node.js – modular, fast, and delightful!
The Modern Node.js Middleware Toolkit - A lightweight, modular middleware system for Express and beyond.
npm install middy-js
# or
yarn add middy-js
# or
pnpm add middy-js
const { Middy } = require('middy-js');
const express = require('express');
const app = express();
const middy = new Middy(app);
// Add middleware
middy.use((req, res, next) => {
console.log('Request received at', new Date());
next();
});
// Add error handler
middy.onError((err, req, res, next) => {
console.error(err);
res.status(500).send('Something broke!');
});
app.get('/', (req, res) => {
res.send('Hello Middy!');
});
app.listen(3000);
middy.use([
// Authentication
require('@middy/auth'),
// Request validation
require('@middy/validator'),
// Response formatting
require('@middy/format-response')
]);
Middy.js comes with several useful middleware:
bodyParser - Parse JSON/URL-encoded bodiescors - Cross-Origin Resource Sharinghelmet - Security headerslogger - Request loggingrateLimit - Rate limitingconst { bodyParser, cors } = require('middy-js/middleware');
middy.use([
cors(),
bodyParser()
]);
function myMiddleware(config) {
return {
before: (req, res, next) => {
// Pre-request logic
req.startTime = Date.now();
next();
},
after: (req, res, next) => {
// Post-request logic
console.log(`Request took ${Date.now() - req.startTime}ms`);
next();
}
}
}
middy.use(myMiddleware({ option: true }));
// Fastify adapter
const fastify = require('fastify');
const { FastifyMiddy } = require('middy-js/adapters');
const app = fastify();
const middy = new FastifyMiddy(app);
| Framework | Requests/sec | Latency (ms) |
|---|---|---|
| Plain Express | 15,678 | 1.21 |
| Middy.js | 14,892 | 1.34 |
| Connect | 14,120 | 1.45 |
Benchmarks run on Node 18, 2.4GHz Quad-Core Intel Core i5
Official plugins:
@middy/auth - Authentication utilities@middy/cache - Request/response caching@middy/validator - Request validation@middy/swagger - OpenAPI/Swagger integrationFAQs
security holding package
The npm package middy-js receives a total of 1 weekly downloads. As such, middy-js popularity was classified as not popular.
We found that middy-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.