UNPKG

@leafage/server

Version:

The React Server Side Render Framework

24 lines (20 loc) 572 B
/** * @leafage/server v1.3.2 * * Copyright (c) Leafage. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ 'use strict'; var httpProxyMiddleware = require('http-proxy-middleware'); var proxyPreset = function proxyPreset(ctx) { var proxy = ctx.options.server.proxy; if (!proxy) return; Object.keys(proxy || {}).forEach(function (key) { ctx.app.use(key, httpProxyMiddleware.createProxyMiddleware(proxy[key])); }); }; exports.proxyPreset = proxyPreset;