
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
@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 565 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.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.