Socket
Book a DemoInstallSign in
Socket

@confluentinc/mox

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@confluentinc/mox

hybrid proxy and mock server

0.1.3
latest
Source
npmnpm
Version published
Weekly downloads
2
Maintainers
2
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 18 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.