{"repo":"mswjs/http-middleware","free":true,"listed":false,"github":"https://github.com/mswjs/http-middleware","clone":"git clone https://github.com/mswjs/http-middleware.git","description":"Spawn an HTTP server from your request handlers or apply them to an existing server using a middleware.","language":"TypeScript","stars":126,"topics":["msw","http","server","express","request","handler","middleware"],"license":null,"category":"api-integrations-sdks","readme_excerpt":"@mswjs/http-middleware Spawn an Express server from your Mock Service Worker request handlers or apply them to an existing server using a middleware. 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). Getting started Install Declare request handlers Learn more about writing request handlers. Integration Option 1: Standalone server Option 2: Middleware API createServer(...handlers: RequestHandler[]) Establishes a standalone Express server that uses the given request handlers to process all incoming requests. Making a GET http://localhost:9090/user request returns the following response: createMiddleware(...handlers: RequestHandler[]) Creates an Express middleware function that uses the given request handlers to process all incoming requests. Mentions - David Idol, original implementation.","default_branch":null,"files":null,"tree":[],"storefront":"/r/mswjs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mswjs/http-middleware/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}