mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
14 lines
No EOL
375 B
JavaScript
14 lines
No EOL
375 B
JavaScript
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)))
|
|
}),
|
|
]; |