Skip to content

Repository files navigation

The Serve library logo

@msw/serve

Spawn a standalone HTTP server from your Mock Service Worker handlers, or apply them as middleware to an existing Express, Hono, or Fastify servers.

When to use this?

You should always prefer Mock Service Worker for API mocking because it can meet most of your requirements without having to spawn and maintain an actual HTTP server. Please refer to the Getting started tutorial to integrate next-generation API mocking into your application.

There are, however, use cases when this extension can be applicable:

  • If you wish to curl your mock definitions locally;
  • When prototyping a Node.js backend implementation;
  • When integrating API mocking in a complex application architecture (i.e. for dockerized applications).

Documentation

Read the documentation.

Mentions

About

Spawn an HTTP server from your request handlers or apply them to an existing server using a middleware.

Topics

Resources

Stars

126 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages