0.2.0 • Published 21 days ago

mocks-server-lite v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
21 days ago

Mocks Server Lite

Credit: This is heavily inspired by mocks-server and takes some of the main concepts from it. It is massively simplified though, currently with only the core functionality as well as being TypeScript first. I created this because the mocks-server project seems to be inactive and doesnt come with types and a few other features I think is key, which are listed below.

Introduction

Node.js mock server running live, interactive mocks in place of real APIs. It makes able to define many different responses for a same route, so, you can change the whole mocked API behavior by simply changing the response of one or many routes while the server is running. This really helps with local FrontEnd development when the BackEnd isnt ready/available and also really good for automated test runs where you want to change how the backing server behaves whilst it is still running.

Installation/Getting Started

Main Features

  • define multiple mock responses (variants) for api endpoints (routes)
  • group together route mock responses in collections
  • change route responses without having to restart the mocks server
  • support route middleware
  • add response delays with route override
  • route call count so you can return something different on subsequent calls
  • web sockets support

Learn more...

Example Repo

https://github.com/burt202/mocks-server-lite-example

  • all mocking code is in mocks/, with the mock server being created in mocks/server.ts
  • also see how the playwright test run can change the behaviour of the mocks server by caling setMockCollection which in turn calls POST /__set-collection with a new collection name
0.2.0

21 days ago

0.1.0

29 days ago

0.0.8

29 days ago

0.0.7

29 days ago

0.0.6

1 month ago

0.0.5

1 month ago

0.0.4

1 month ago

0.0.3

1 month ago

0.0.2

1 month ago

0.0.1

1 month ago