
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
pizzly-node
Advanced tools
Node.js client to query any APIs using Pizzly.
npm install pizzly-node
# or
yarn add pizzly-node
Once a user is connected, you can use its authId
to query any endpoint of the API.
const Pizzly = require('pizzly-node') // or import { Pizzly } from 'pizzly-node'
const pizzly = new Pizzly({ host: 'pizzly.example.org' }) // Initialize Pizzly with your own instance
const myAPI = pizzly.integration('x-api') // Replace with the API slugname
myAPI
.auth('x-auth-id') // Replace with a valid authId
.get('/x-endpoint') // Replace with a valid endpoint
.then(response => console.log) // Do something with the response
.catch(console.error)
Most common HTTP methods are supported out-of-the-box, including .get()
, .post()
, .put()
and .delete()
.
Under the hood, we use node-fetch
to send requests. As a consequence, each response
from the API are Response
class of the node-fetch package. When the API uses JSON response type, you can retrieve the JSON response as follow:
myAPI
.auth('x-auth-id')
.get('/x-endpoint')
.then(response => response.json())
.then(data => console.log(data)) // do something with the JSON payload (aka data)
.catch(console.error)
It's highly recommended to secure your Pizzly instance after deployment (learn more). Once you've added a secret key, pass it to the client as follow:
const Pizzly = require('pizzly-node') // or import { Pizzly } from 'pizzly-node'
const pizzly = new Pizzly({
host: 'x-replace-with-your-pizzly-instance',
secretKey: 'x-replace-with-your-secret-key'
})
Here's how to send headers to the API:
myAPI
.auth('x-auth-id')
.post('/x-endpoint', { headers: { 'Content-Type': 'multipart/form-data; boundary=something' } })
.then(console.log)
.catch(console.error)
Here's how to send query string to the API:
myAPI
.auth('x-auth-id')
.post('/x-endpoint', { query: { search: 'some keywords' } })
.then(console.log)
.catch(console.error)
Sending body works the same way:
myAPI
.auth('x-auth-id')
.post('/x-endpoint', { body: 'My body' })
.then(console.log)
.catch(console.error)
Using async/await
is supported to improve code readability:
const response = await pizzly.integration('x-api').get('/x-endpoint')
In that snippet, response
will be a Response
interface of the node-fetch package.
By default, each request made through Pizzly uses the latest configuration that you have saved. If you have multiple configurations in place for the same API, you can tell Pizzly which configuration should be used.
const config1 = '...'
const config2 = '...'
const github1 = pizzly.integration('github').setup(config1)
const github2 = pizzly.integration('github').setup(config2)
// Make a request with the 1st configuration
github1.get('/')
// Make another request with the 2nd configuration
github2.get('/')
Pizzly Node.js client's reference:
/**
* Pizzly global namespace. Call it to initialize a Pizzly instance.
*
* @params options <object>
* - host <string> - The host of your Pizzly instance (e.g. "pizzly.example.org")
* - secretKey <string> - Optional. The secret key of your Pizzly instance
*
* @returns a new Pizzly instance.
*/
const Pizzly = (options) => {
/**
* Integration's instance
*/
integration: {
/**
* Set the configuration to use
*
* @params setupId <string> - The configuration ID
* @returns a new integration's instance
*/
setup: (setupId) => {},
/**
* Set the authentication to use
*
* @params authId <string> - The authentication ID
* @returns a new integration's instance
*/
auth: (authId) => {},
/**
* Make a proxy request to the API (requests pass through the /proxy/ endpoint)
*
* @params endpoint <string> - The distant API endpoint
* @params options <object> - The request options:
* - headers <object> - The headers to send (e.g. { "Content-Type": "application/json" })
* - query <object> - The query string to use (e.g. { "startAt": "1" } will be transformed into "?startAt=1")
* - body <object> - The request's body to append (e.g. "foo=bar")
* @returns a node-fetch response schema (https://www.npmjs.com/package/node-fetch)
*/
get: (endpoint[, options]) => {},
post: (endpoint[, options]) => {},
put: (endpoint[, options]) => {},
delete: (endpoint[, options]) => {},
head: (endpoint[, options]) => {},
patch: (endpoint[, options]) => {},
}
}
[v0.2.1] - 2021-05-12
FAQs
Node.js client for Pizzly
The npm package pizzly-node receives a total of 1 weekly downloads. As such, pizzly-node popularity was classified as not popular.
We found that pizzly-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.