MCPcopy
hub / github.com/mswjs/msw / setupServer

Function setupServer

src/node/setup-server.ts:49–62  ·  view source on GitHub ↗
(...handlers: Array<AnyHandler>)

Source from the content-addressed store, hash-verified

47 * @see {@link https://mswjs.io/docs/api/setup-server `setupServer()` API reference}
48 */
49export function setupServer(...handlers: Array<AnyHandler>): SetupServer {
50 const handlersController = new AsyncHandlersController(handlers)
51 const network = defineNetwork({
52 ...defaultNetworkOptions,
53 handlers: handlersController,
54 })
55
56 const commonApi = defineSetupServerApi(network)
57
58 return {
59 ...commonApi,
60 boundary: handlersController.boundary.bind(handlersController),
61 }
62}
63
64/**
65 * @deprecated

Calls 2

defineNetworkFunction · 0.90
defineSetupServerApiFunction · 0.90

Tested by 1

createServerFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…