Registry / devops / axios-express-proxy

axios-express-proxy

JSON →
library1.1.0jsnpmunverified

A lightweight package (v1.1.0, no breaking changes yet) that proxies Express requests to Axios and sends back the response. It simplifies forwarding HTTP requests from an Express server to another URL using Axios, handling method, headers, query, and body automatically. Ships TypeScript types. Main differentiator: minimal abstraction over manual Express-to-Axios forwarding, reducing boilerplate while maintaining full control. Release cadence is ad-hoc with no frequent updates. Suitable for simple proxy use cases but lacks advanced features like load balancing or caching found in dedicated proxy libraries.

npm install axios-express-proxy
INSTALL
IMPORT
SIG · AXIOS-EXPRESS-PROX
A
axios-express-proxy
devopsjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Proxy
import { Proxy } from 'axios-express-proxy'
const Proxy = require('axios-express-proxy').Proxy
ESM-only module; CommonJS require will fail. Named export.
SendAxiosRequest
import { SendAxiosRequest } from 'axios-express-proxy'
import SendAxiosRequest from 'axios-express-proxy'
Named export, not default.
SendExpressResponse
import { SendExpressResponse } from 'axios-express-proxy'
require('axios-express-proxy').SendExpressResponse
ESM-only; named export.

Creates an Express server that proxies incoming requests to another URL using the Proxy function.

import express from 'express'; import axios from 'axios'; import { Proxy } from 'axios-express-proxy'; const app = express(); const port = 3000; app.get('/proxy/*', (req, res) => { const targetUrl = 'http://localhost:8080' + req.originalUrl.replace('/proxy', ''); Proxy(targetUrl, req, res); }); app.listen(port, () => { console.log(`Proxy server listening at http://localhost:${port}`); });
Debug
Known issues
gotchaThe Proxy function mutates the response object; it's not a middleware that calls next(). You cannot chain multiple proxies or middleware after it.
fix
Call Proxy as the final handler; do not attempt to send the response after Proxy returns.
affects: *
gotchaWhen using the Proxy function, errors from the target server are not automatically caught. Unhandled rejections may crash the process.
fix
Wrap Proxy call in try-catch or attach .catch() to the returned promise.
affects: <=1.1.0
deprecatedThe package does not follow semantic versioning; minor versions may include breaking changes without notice.
fix
Pin version in package.json and review changelog before upgrading.
affects: *
gotchaThe Proxy function does not support streaming responses; the entire response body is buffered.
fix
For large responses, consider using http-proxy-middleware instead.
affects: <=1.1.0
gotchaThe function does not validate the target URL; passing an invalid URL may throw an unhandled error.
fix
Validate the target URL before passing to Proxy.
affects: <=1.1.0
Errors
Common errors & fixes
TypeError: Proxy is not a function
Incorrect import: using default import instead of named import.
fix
Use `import { Proxy } from 'axios-express-proxy';`
Cannot find module 'axios-express-proxy'
Package not installed or typo in package name.
fix
Run `npm install axios-express-proxy` and verify package.json.
UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED ::1:8080
Target server is not running or unreachable.
fix
Ensure the target URL is correct and the server is running.
TypeError: res.send is not a function
Passing a non-Express response object to Proxy.
fix
Ensure the second argument to Proxy is an Express response object.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
axiosrequiredrequired to make HTTP requests
expressrequiredrequired to handle incoming requests
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
axios-express-proxy — npm install axios-express-proxy · libregistry