
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.
Create an API/Server without having to create the actual server yourself, all you have to worry about is the routes. ## Install ```sh npm i --save z-api ``` ## Usage ```js const Zapi = require('z-api'), api = new Zapi() ```
Create an API/Server without having to create the actual server yourself, all you have to worry about is the routes.
npm i --save z-api
const Zapi = require('z-api'),
api = new Zapi()
const route = {
method: 'GET', //Default is GET if not specified, Must be in caps
path: '/', //Default is '/' if not specified,
handler: (req, res) => {
/*
req and res are the standard http objects
A good guide on how to use them here
https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/
*/
res.end('The api works)
}
}
api.addRoute(route)
api.removeRoute('GET', '/') //Method and path
Options can be passed set when initialising the class, or they can be set later on.
api = new Zapi({
port: 80
})
api.config.port = 80
The following are config options that are currently used, more may be added in the future.
The port to run the server on, the default is 3002.
port: 3002
The default route options to use if that option is not specified. The default method is GET. The default path is '/'. The default handler sends a response saying 'Default route'.
defaultRoute: {
method: 'GET',
path: '/',
handler: (req, res) => {
res.send('Default route')
}
}
Middleware is run in parallel for the best performance. To add middleware use the addMiddleware function.
api.addMiddleware((req, res, next) => {
console.dir(req)
next()
})
FAQs
Create an API/Server without having to create the actual server yourself, all you have to worry about is the routes. ## Install ```sh npm i --save z-api ``` ## Usage ```js const Zapi = require('z-api'), api = new Zapi() ```
The npm package z-api receives a total of 1 weekly downloads. As such, z-api popularity was classified as not popular.
We found that z-api 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.