サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
Pixel 9
mswjs.io
This November marks five years since Mock Service Worker has been first added to a package.json. Over that time, I have learned a lot about building libraries, designing APIs, and cultivating communities, which makes today’s announcement all the more special. Version 2.0 marks a monumental chapter for MSW. A year in development, dozens of contributors, and thousands of lines changed, this update b
About the release Version 2.0 brings the biggest API change to the library since its inception. Alongside the new API, it includes various features, such as ReadableStream support, ESM-compatibility, and countless bug fixes. This guide will help you migrate your application to version 2.0. We highly recommend you read it from start to finish. Make sure to read the official announcement for this re
Developers use MSW for many things: to mock APIs in testing, to debug network while developing, to present their work across teams, to monitor the outgoing traffic, etc. Writing a single tutorial that would suit all those use cases is rather difficult. There’s good news, however. Working with MSW follows the same flow, no matter how and where you decide to use it. Below, you can find a complete, b
import { http, HttpResponse } from 'msw'import { setupWorker } from 'msw/browser' // Describe the network.const handlers = [ http.get('https://acme.com/product/:id', ({ params }) => { return HttpResponse.json({ id: params.id, title: 'Porcelain Mug', price: 9.99, }) }),] // Enable API mocking anywhere.const worker = setupWorker(...handlers)await worker.start() Omit implementation details Intercept
このページを最初にブックマークしてみませんか?
『Mock Service Worker』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く