Skip to content

Instantly share code, notes, and snippets.

View SevenOutman's full-sized avatar
🈺
再营业

Doma SevenOutman

🈺
再营业
View GitHub Profile
@SevenOutman
SevenOutman / handlers.ts
Created May 30, 2023 14:34
This gist demonstrates how you can manage Mock Service Worker handlers in Next.js API Routes style in your Vite project
import { rest } from "msw";
// https://vitejs.dev/guide/features.html#glob-import
const imports = import.meta.glob("./api/**/*.ts", { eager: true });
export const handlers = Object.entries(imports).reduce(
(allHandlers, [path, handlers]) => {
// map "./path/[to]/handlers.js" -> "/api/path/:to/handlers"
const apiPath =
"/" +
@SevenOutman
SevenOutman / README.md
Last active July 20, 2023 06:59
require.context polyfill