
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
Standardized API response and error handling toolkit with async handler, requestId, logging, and configurable formats.
A lightweight utility library for standardized API responses, async error handling, and configuration-driven response formatting in Express.js applications.
successResponse, errorResponse)asyncHandler wrapper for safe async/await route handlingApiError class for consistent error throwingstandardize) to attach res.success and res.error methodsnpx api-stds init
This will set up the package in your project.
import express from "express";
import { standardize } from "api-stds";
const app = express();
// Apply standardize middleware
app.use(standardize());
This middleware extends the res object with:
res.success(data, meta?);
res.error(code, message?, details?, meta?);
app.get("/ping", (req, res) => {
return res.success({ pong: true });
});
Response:
{
"success": true,
"data": { "pong": true },
"error": null,
"meta": {
"timestamp": 1734913293044,
"apiVersion": "v1"
}
}
app.get("/error", (req, res) => {
return res.error("NOT_FOUND", "Resource not found", { resource: "User" });
});
Response:
{
"success": false,
"data": null,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": { "resource": "User" }
},
"meta": {
"timestamp": 1734913293044,
"apiVersion": "v1"
}
}
import { asyncHandler, ApiError } from "api-stds";
app.get(
"/users/:id",
asyncHandler(async (req, res) => {
const user = await User.findById(req.params.id);
if (!user) throw new ApiError("NOT_FOUND", "User not found");
return res.success(user);
})
);
import { ApiError } from "api-stds";
throw new ApiError("BAD_REQUEST", "Invalid input", [
{ field: "email", message: "Email is required" },
]);
app.use(
standardize({
response: {
includeMeta: true,
timestampFormat: "iso", // "unix" | "iso"
defaultApiVersion: "v2",
metaFields: ["timestamp", "apiVersion"],
},
})
);
import { loadErrorRegistry, getError } from "api-stds";
loadErrorRegistry({
NOT_FOUND: "The resource was not found",
UNAUTHORIZED: "Unauthorized access",
});
res.error("NOT_FOUND", getError("NOT_FOUND"));
{
"success": boolean,
"data": object | null,
"error": {
"code": string,
"message": string,
"details": any
} | null,
"meta": {
"timestamp"?: number | string,
"apiVersion"?: string
}
}
FAQs
Standardized API response and error handling toolkit with async handler, requestId, logging, and configurable formats.
The npm package api-stds receives a total of 2 weekly downloads. As such, api-stds popularity was classified as not popular.
We found that api-stds demonstrated a healthy version release cadence and project activity because the last version was released less than 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.