mockiji-proxy-middleware

1.0.0 • Public • Published

Mockiji-Proxy-Middleware

A basic proxy middleware for Mockiji.

Usage

const Mockiji = require('mockiji');
 
const server = new Mockiji({
  configuration: {
    middlewares: [
      require('mockiji-proxy-middleware')({
        checkMockStatus: true,
        paths: {
          '/api/test/book/.*': 'my-books-api.local',
          '/api/test/user/[0-9]+': '127.0.0.1:8083',
        },
      })
    ]
  }
});
 
server.start();

Parameters

Name Default Description
checkMockStatus true If set to true proxying will only happen if Mockiji could not find a mock file matching the request
timeout 60 Timeout in seconds for proxied requests
paths {} An object in which keys are regular expressions and values are the hosts the requests should be redirected to

Readme

Keywords

none

Package Sidebar

Install

npm i mockiji-proxy-middleware

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ldiringer
  • lyrkan