0.1.0 • Published 3 years ago
koa-undici-proxy v0.1.0
koa-undici-proxy
Yet another Koa proxy based on undici.
Install
npm install koa-undici-proxyor
yarn add koa-undici-proxyUsage
const Koa = require('koa');
const proxy = require('koa-undici-proxy');
const app = new Koa()
app.use(proxy('https://httpbin.org'))
app.listen(3000)
// Now you can access https://httpbin.org/ using http://localhost:3000/Config
The proxy() function also accepts an undici Client, so you can use it like:
const Koa = require('koa');
const proxy = require('koa-undici-proxy');
const { Client } = require('undici');
const app = new Koa()
const client = new Client('https://httpbin.org', {
// I want to proxy big blobs so disable the timeout of receiving body.
bodyTimeout: 0,
})
app.use(proxy(client))
app.listen(3000)License
MIT License
0.1.0
3 years ago