Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@sumor/api-middleware
Advanced tools
API Middleware is a middleware for Node.JS. It can easily expose function to api, and validate parameters
A Sumor Cloud Tool.
More Documentation
API Middleware is a middleware for Node.JS.
It can easily expose function to api, and validate parameters
npm i @sumor/api-middleware --save
Require Node.JS version 16.x or above
As this package is written in ES module,
please change the following code in your package.json
file:
{
"type": "module"
}
plus.js
in your project folder api
export default async (context, req, res) => {
const { data } = context
const { a, b } = data
return a + b
}
[Optional] 2. Add a file named plus.json
in your project folder api
{
"name": "plus",
"parameters": {
"a": {
"name": "parameter a",
"type": "number",
"length": 3
},
"b": {
"name": "parameter b",
"type": "number"
}
}
}
index.js
fileimport express from 'express'
import apiMiddleware from '@sumor/api-middleware'
const app = express()
apiMiddleware(app, process.cwd() + '/api')
app.listen(3000, () => {
console.log('Server is running on http://localhost:3000')
})
run index.js
node index.js
FAQs
API Middleware is a middleware for Node.JS. It can easily expose function to api, and validate parameters
The npm package @sumor/api-middleware receives a total of 55,924 weekly downloads. As such, @sumor/api-middleware popularity was classified as popular.
We found that @sumor/api-middleware demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.