
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
rx-express-middleware
Advanced tools
An opinionated set of middleware to use on an express API.
import attachMiddleware, { handleError } from 'rx-express-middleware';
const app = express();
attachMiddleware(app, {
maxBodySize: string | undefined; // Max body size (default: 50mb)
cookieSecret: string | undefined; // Secret for cookie parser
cookieOptions: CookieParseOptions | undefined; // Cookie options
} | undefined);
app.use(baseRouter);
app.use(handleError({
prisma: boolean | undefined; // Handle Prisma errors
}))
If you want to specify a specific error code, you can set the error cause to it. For example:
throw new Error('unauthenticated', { cause: new Error('401') });
Formatting functions are provided through import
Pagination can be imported through rx-express-middleware/dist/prismaPagination
For example:
// index.ts
import { PrismaClient } from '@prisma/client';
import { initiatePagination } from 'rx-express-middleware/dist/prismaPagination';
export const prisma = new PrismaClient();
export const paginate = initiatePagination(10, prisma);
// controller.ts
import { paginate } from './index.ts';
import { RequestHandler } from 'express';
export const handler: RequestHandler = async (req, res) => {
res.json(
await paginate(req.stringQuery, 'user', {
where: {
name: { contains: req.stringQuery.name },
},
select: {
name: true,
},
} as Prisma.UserFindManyArgs),
);
};
FAQs
Collection of useful express middleware.
The npm package rx-express-middleware receives a total of 3 weekly downloads. As such, rx-express-middleware popularity was classified as not popular.
We found that rx-express-middleware 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.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.