Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
httpexceptions
Advanced tools
Provide Exceptions for REST API based on Express.js.
This module lets you to throw an HTTPException quickly.
Some HTTP Exception are already implemented :
You can use HTTPException method to throw a custom Exception (see example).
Use npm install httpexceptions
.
var httpException = require('httpexception');
var express = require('express');
var app = express();
httpException.debug(true);
app.use(httpException.mime('application/json'));
app.use(httpException.paramsRequired());
// OR
// app.use(httpException.mime(['application/json', 'text/xml']));
app.get('/my/route/exception', function(req, res){
throw new httpException.BadRequest('Custom Message'); //Emit
// OR
// throw new httpException.HTTPException(510, 'Custom Message');
});
app.get('/my/route/params', function(req, res){
req.paramsRequired({
query:['id']
}); //throw a BadRequest exception if the parameters id isn't defined in queryParams
});
//at the end
//GlobalHandler middleware catch exception and send response to the client
app.use(httpException.globalHandler());
Use npm test
.
FAQs
Provide exception for HTTP Rest API
The npm package httpexceptions receives a total of 0 weekly downloads. As such, httpexceptions popularity was classified as not popular.
We found that httpexceptions 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 uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.