
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
expressjs-response
Advanced tools
Express middleware to generate JSON response
npm install expressjs-response --save
Use as Express middleware
import express from 'express'
import responseEnhancer from 'expressjs-response'
const app = express()
// use in express middleware
app.use(responseEnhancer({
withStatusCode: true, // Include status code in response body.
withStatusMessage: true, // Include status message in response body.
}))
// example usage
app.get('/success', (req, res) => res.ok({ name: 'John Doe' }))
app.get('/badrequest', (req, res) => res.badRequest('Invalid parameter.'))
app.get('/badgateway', (req, res) => res.badGateway())
app.listen(3000, () => console.log('Start at http://localhost:3000'))
res.ok({ name: 'John Doe' })
HTTP/1.1 200 Ok
{
"status": "success",
"data": {
"name": "John Doe"
}
}
res.badRequest()
HTTP/1.1 400 Bad Request
{
"status": "fail",
"error": {
"code": "400",
"message": "Bad Request"
}
}
res.badRequest('Invalid parameter.')
HTTP/1.1 400 Bad Request
{
"status": "fail",
"error": {
"code": "400",
"message": "Bad Request",
"detail": "Invalid parameter."
}
}
res.badGateway()
HTTP/1.1 502 Bad Gateway
{
"status": "error",
"error": {
"code": "502",
"message": "Bad Gateway"
}
}
| METHOD | CODE | PARAMS |
|---|---|---|
| res.ok() | 200 | res.ok(data) |
| res.created() | 201 | res.created(data) |
| res.noContent() | 204 | - |
| res.badRequest() | 400 | res.badRequest(error) |
| res.unauthorized() | 401 | res.unauthorized(error) |
| res.forbidden() | 403 | res.forbidden(error) |
| res.notFound() | 404 | res.notFound(error) |
| res.methodNotAllowed() | 405 | res.methodNotAllowed(error) |
| res.unprocessableEntity() | 422 | res.unprocessableEntity(error) |
| res.internalServerError() | 500 | res.internalServerError(error) |
| res.badGateway() | 502 | res.badGateway(error) |
| res.serviceUnavailable() | 503 | res.serviceUnavailable(error) |
| res.gatewayTimeout() | 504 | res.gatewayTimeout(error) |
FAQs
Express middleware to generate JSON response
The npm package expressjs-response receives a total of 7 weekly downloads. As such, expressjs-response popularity was classified as not popular.
We found that expressjs-response 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.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.