Socket
Book a DemoInstallSign in
Socket

@charlietango/msw-fastify-middleware

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@charlietango/msw-fastify-middleware

Create a middleware for MSW to use with [Fastify](https://www.fastify.io/).

3.1.0
latest
npmnpm
Version published
Weekly downloads
12
20%
Maintainers
2
Weekly downloads
 
Created
Source

@charlietango/msw-fastify-middleware

Create a middleware for MSW to use with Fastify.

Usage with SSR Vite

Load the async handlers inside the server file. They will be reloaded on change, so you get the latest data on every request.

import { mswFastifyMiddleware } from '@charlietango/msw-fastify-middleware';

app.all(
  "/api/*",
  mswFastifyMiddleware(async () => {
    const { handlers } = await vite.ssrLoadModule(
      "./src/api/mocks/handlers.ts"
    );
    return handlers;
  })
);

Params

  • handlers Handlers Set the MSW request handlers. Either as an array, or as an async function that returns the handlers.
  • handleRequestOptions Options to pass to the MSW handleRequest function.

FAQs

Package last updated on 09 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.