Skip to content

nickhudkins/malcolm

Repository files navigation

👴🏻 Malcolm (in the Middle)

It's Man-In-The-Middle-Proxy for Development

Usage

Create a proxy.config.ts:

import { defineConfig } from "@nickhudkins/malcolm";

export default defineConfig({
  hosts: ["google.com"],
  handleRequest: async (req) => {
    const url = new URL(req.url);
    return {
      ctx: {
        requestURL: url,
      }
    }
  },
  handleResponse: (
    res: PassThroughResponse,
    ctx
  ) => {
    // I have `ctx`! which is provided by the above
    return;
  },
});

Run malcolm

Development

  1. Clone
  2. Create a proxy.config.ts in the packages/proxy directory
  3. npm run i
  4. npm run build
  5. npm run start:dev -w packages/proxy
    • Note: Malcom should not be run with turbo due to STDIO issues where an input prompt is not provided within the execution content

❤️ Made with Love by @nickhudkins

About

It's a thing I'm working on.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •