
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
express-http-codes
Advanced tools
Adds methods to Express responses for dispatching HTTP status.
$ npm i -s express-http-codes
To standarize basic HTTP response dispatching across files and applications.
The following HTTP statuses are already supported:
const expressHttp = require("express-http-codes");
/////////////////////////////////////////////
// In 1 step:
const express = expressHttp(require("express"));
// Alternatively, in 2 steps:
const express = require("express");
expressHttp(express);
/////////////////////////////////////////////
const app = express();
app.get("/success", (rq, rs) => rs.httpSuccess({ message: "This is a success" }, 200));
/*
--- Returns: ---
{
success: true,
code: 200,
status: "OK",
message: "This is a success"
}
*/
app.get("/error/404", (rq, rs) => rs.httpError({ message: "This is an error" }, 404));
/*
--- Returns: ---
{
error: true,
code: 404,
status: "Not found",
message: "This is an error"
}
*/
app.get("/error/custom", (rq, rs) => rs.httpError({ message: "This is an error" }, 901));
/*
--- Returns: ---
{
error: true,
code: 901,
status: "Custom error",
message: "This is an error"
}
*/
const server = app.listen(8080, () => console.log("Server listening."));
By default, if you use httpSuccess({...}) without code, it will respond a 200: OK.
By default, if you use httpError({...}) without code, it will respond a 400: Bad request.
$ npm run test
This project adheres to the Semmantic Versioning 2.0.0.
You can send your issues here.
As I do not have a job, I do not practice this part of "collective" coding, but I guess you can create your own branches.
This project is under WTFPL.
FAQs
Adds methods to Express responses for dispatching HTTP status.
We found that express-http-codes 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.