mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
15 lines
No EOL
401 B
JavaScript
15 lines
No EOL
401 B
JavaScript
import path from 'node:path'
|
|
import fs from 'fs/promises'
|
|
|
|
import { rest } from 'msw'
|
|
|
|
export const handlers = [
|
|
rest.get('https://mock.msw/*', async (req, res, ctx) => {
|
|
const { endpoint } = req.params;
|
|
const urlPath = req.url.pathname
|
|
|
|
const fileContent = await fs.readFile( `./static/${urlPath}`, 'utf8')
|
|
|
|
return res(ctx.json(JSON.parse(fileContent)))
|
|
}),
|
|
]; |