·
Across the Great Wall, we can reach every corner in the world.

mswjs 有一个折中的方法:让 msw mock 独立运行,不依赖于 nextjs/react 等前端环境。

插件:http-middleware

// eslint-disable-next-line import/no-extraneous-dependencies
import { createServer } from '@mswjs/http-middleware';
import { handlers } from './handlers';

const httpServer = createServer(...handlers);
httpServer.listen(9090);