It's Man-In-The-Middle-Proxy for Development
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
- Clone
- Create a
proxy.config.ts
in thepackages/proxy
directory npm run i
npm run build
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