orator-http-proxy
raw JSON → 1.0.5 verified Sat Apr 25 auth: no javascript
HTTP proxy pass-through module for Orator service servers. It forwards incoming requests matching configured route prefixes to a backend destination URL. Works with Fable and Orator frameworks. Supports GET, PUT, POST, DELETE. Handles HTTP-to-HTTPS proxying. Version 1.0.5 is stable but low activity. Similar to http-proxy-middleware but specifically integrated with the Orator ecosystem.
Common errors
error TypeError: _Fable.OratorHTTPProxy is undefined ↓
cause addServiceType or instantiateServiceProvider not called correctly.
fix
Ensure you call addServiceType('OratorHTTPProxy', libOratorHTTPProxy) before instantiateServiceProvider.
error Error: Cannot find module 'fable' ↓
cause Missing peer dependency 'fable'.
fix
Install fable: npm install fable
error Error: Must call initialize before connecting proxy routes ↓
cause connectProxyRoutes called outside initialize callback.
fix
Move connectProxyRoutes into the initialize callback function provided to _Fable.Orator.initialize().
Warnings
gotcha Package is CommonJS only. Using ES import syntax will result in an error. ↓
fix Use require() instead of import.
gotcha Orator, fable, and orator-serviceserver-restify are required as peer dependencies but not listed in package.json. ↓
fix Install them manually: npm install fable orator orator-serviceserver-restify
gotcha Proxy routes must be connected after Orator is initialized and before startService. ↓
fix Call connectProxyRoutes inside the initialize callback.
deprecated Fable version compatibility unknown; may break if Fable major version bumps. ↓
fix Check the Fable version used; ensure it's compatible with existing tests.
Install
npm install orator-http-proxy yarn add orator-http-proxy pnpm add orator-http-proxy Imports
- orator-http-proxy wrong
import libOratorHTTPProxy from 'orator-http-proxy';correctconst libOratorHTTPProxy = require('orator-http-proxy'); - connectProxyRoutes wrong
import { connectProxyRoutes } from 'orator-http-proxy';correctFable.OratorHTTPProxy.connectProxyRoutes(); - service provider registration wrong
Fable.addService('OratorHTTPProxy', ...)correctFable.serviceManager.addServiceType('OratorHTTPProxy', require('orator-http-proxy'));
Quickstart
const libFable = require('fable');
const libOrator = require('orator');
const libOratorServiceServerRestify = require('orator-serviceserver-restify');
const libOratorHTTPProxy = require('orator-http-proxy');
const _Fable = new libFable({
Product: 'MyProxyServer',
ServicePort: 8080
});
_Fable.serviceManager.addServiceType('Orator', libOrator);
_Fable.serviceManager.addServiceType('OratorServiceServer', libOratorServiceServerRestify);
_Fable.serviceManager.instantiateServiceProvider('Orator');
_Fable.serviceManager.instantiateServiceProvider('OratorServiceServer');
_Fable.serviceManager.addServiceType('OratorHTTPProxy', libOratorHTTPProxy);
_Fable.serviceManager.instantiateServiceProvider('OratorHTTPProxy', {
DestinationURL: 'http://backend-api:3000/',
RequestPrefixList: ['/api/v1/*']
});
_Fable.Orator.initialize(() => {
_Fable.OratorHTTPProxy.connectProxyRoutes();
_Fable.Orator.startService();
});