UNPKG

api-service-core

Version:

NodeJS api-service

41 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // import { request, IncomingMessage } from "http"; // import { Vars } from "../core"; /** * Dynamic Reverse Proxy * ------------------ * Attach a remote OpenAPI spec to a local OpenAPI resource * The implementation of a HTTP Proxy plugin using the node-http-proxy package. * * See https://github.com/nodejitsu/node-http-proxy * * TODO: integrate with Vault to retrieve secrets and inject into egress request via header/params/etc. * */ class mount { constructor() { this.name = "api.mount"; this.title = "Mount remote OpenAPI spec as proxy"; } /** * plugin to proxy requests to a remote HTTP endpoint * * @param context * @param options * @returns {TargetEndpoint} */ fn(_op, _options) { // let context = operation.context; // let options = _.extend({ url: false, proxy: {} }, operation.feature, _options); // request(options.url, (res: any) => { // let json = JSON.parse( res.body); // // wire-up our reverse-proxy - but only once // // this.setupProxyServer( operation, options ); // } return null; } ; } exports.default = mount; //# sourceMappingURL=mount.js.map