GithubHelp home page GithubHelp logo

pdibenedetto / mox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from confluentinc/mox

0.0 1.0 0.0 617 KB

A hybrid mock and proxy server - easily programmable and runs on express

License: MIT License

JavaScript 100.00%

mox's Introduction

Mox

A node.js developer tool written on top of express.js. Mox is a cross between a mock and a proxy server.

See here for the NPM package

Why this exists

Mox's purpose is to bridge the gap between mock server usage and live backend usage. Frontend development processes typically fall into one of two camps:

  • Build off of mock servers
  • Build off of a local or hosted development backend

Mox is a tool that helps you use both at the same time. It also provides a few other APIs that make the second camp a lot easier.

Some key features:

  • Read or modify requests/responses in-flight
  • Mock individual endpoints or set of endpoints
  • Express.js based routing and pattern matching

Installation

Install this package through npm or yarn.

npm install @confluentinc/mox

The basics

Here's a quick example of what it takes to configure the server, perform a simple mock, and get it running.

import { MoxServer } from '@confluentinc/mox';

const server = new MoxServer({ targetUrl: 'https://dev.server', listenPort: 3005 });
const router = server.getRouter();

router.get('/api/route-to-mock').mock({ foo: 'bar' });

server.start();

Mox supports most common HTTP methods, including HEAD, OPTIONS, and PATCH. It also supports the all matcher from express.js which matches all methods.

In the above example, router.get matches the same way app.get would in express.

Documentation

More detailed API reference

mox's People

Contributors

alex-cf avatar srpanwar-confluent avatar dependabot[bot] avatar

Watchers

James Cloos 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.