
Product
Announcing Precomputed Reachability Analysis in Socket
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
@cloudflare/util-mock-api
Advanced tools
In-memory API scaffolding for mocking backends that don't exist yet.
Express style, in-memory API scaffolding for mocking backends that don't exist yet.
Prototype faster, now, today.
$ npm install @cloudflare/util-mock-api
In your feature, make a mockApi.ts and implement your own api responses and store.
import mockApi from '@cloudflare/util-mock-api'
// persist your store in localStorage
const _storedWorkers = window.localStorage.getItem('storedWorkers')
// fetchGetWorkerDetails({ routeParams, queryParams }) => ...
const fetchGetWorkerDetails = ({ routeParams }) => {
const found = _storedWorkers.find(
worker => worker.script_id === routeParams.workerId,
)
return {
body: {
result: found,
}
}
}
export default mockApi.server({
endpoints: [
{
route: '/api/v3/workers/scripts/:workerId/details',
response: fetchGetWorkerDetails,
}
]
})
When mockApi.server()
appears in your code, Mock API controls appear in the top corner of your UI where you can toggle the mock server on and off as well as clear the current mock data. Clearing mock data will generate fresh mocks.
FAQs
In-memory API scaffolding for mocking backends that don't exist yet.
The npm package @cloudflare/util-mock-api receives a total of 658 weekly downloads. As such, @cloudflare/util-mock-api popularity was classified as not popular.
We found that @cloudflare/util-mock-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 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.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.