Giter VIP home page Giter VIP logo

koa-mock-proxy's Introduction

Koa mock proxy

koa-mock-proxy is a tool for creating proxy servers with the ability to record and replay responses (mocks).

It can be useful for:

  • service/integration tests (in case you want to test only frontend)
  • e2e tests mocking only chosen endpoints
  • Manually testing application without backend or for a specific scenario that's difficult to reproduce
  • Logging activity between services

You are free to use all possibilities of Koa (custom middlewares like koa-router).

Features

  • Proxy http requests
  • Record requests and responses (body and headers) into human-readable files
  • Log proxy requests, view it using the UI
  • Manage different test scenarios (depending on a scenario, the same endpoint can return different responses)

Main advantages

  • A public API made in a very familiar way for many JS developers (using middlewares)
  • Recorded mocks are suitable to put in a version control system, easy to understand and update
  • Composability with other libraries and code from custom mocks
  • UI for easier debugging and recording of mocks

Installation

Install using npm:

npm i koa-mock-proxy

Also, it's necessary to install koa, if you don't have it in your project:

npm i koa

Docs

Full docs are available here

And a lot of examples are here

Debugging

You can set env variable DEBUG_PROXY=true if you want to see in console all requests coming through mock server.

koa-mock-proxy's People

Contributors

webscout avatar dmitrybmsk avatar vint52 avatar

Stargazers

Timofey avatar Igor Sterzhakov avatar  avatar Nikita avatar  avatar  avatar Eugene Zlobin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.