Proxy Middleware

Node.js proxying made simple. Package helps to create and configure proxy middleware with ease for connect, express and more to deal with Poq Platform services.

Installation

npm install @poq/proxy-middleware

Usage

import { createApplication } from 'express-like-lib';
import { ProxyHandlerFactory } from '@poq/proxy-middleware';
const app = createApplication();
const proxyHandler = ProxyHandlerFactory.create({
target: POQ_PLATFORM_BASE_URL
});
app.get('/appstories/apps/:appid/home', proxyHandler);

Example of the configuration for Express

const proxyHandler = ProxyHandlerFactory.create({
target: 'https://platform.poq.io'
});
app.get('/appstories/apps/:appid/home', proxyHandler);
app.get('/banners/:appid', proxyHandler);
app.get('/cart', proxyHandler);
app.post('/cart', proxyHandler);
app.post('/cart/items', proxyHandler);
app.post('/checkout/complete', proxyHandler);
app.get('/contentblocks/:appid/:categoryid', proxyHandler);
app.get('/lookbooks/:appid/:lookbookid', proxyHandler);
app.get('/shop', proxyHandler);
app.get('/pages/:appid/:pageid', proxyHandler);
app.get('/products', proxyHandler);
app.get('/search', proxyHandler);
app.get('/search/predictive', proxyHandler);
app.get('/settings/config/:appid/:settingid', proxyHandler);
app.get('/splash/ios/:appid:/:v', proxyHandler);
app.get('/stores/:appid', proxyHandler);
app.get('/stores/:appid/:storeid', proxyHandler);
app.get('/wishlist', proxyHandler);
app.post('/wishlist', proxyHandler);
app.delete('/wishlist', proxyHandler);
app.post('/wishlist', proxyHandler);
app.delete('/wishlist', proxyHandler);