forked from ExpressGateway/express-gateway-plugin-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda-proxy.js
More file actions
27 lines (22 loc) · 702 Bytes
/
lambda-proxy.js
File metadata and controls
27 lines (22 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { CustomIntegration } = require('./custom-integration');
const { ProxyIntegration } = require('./proxy-integration');
const { createSettings } = require('./create-settings');
const { getBody } = require('./get-body');
module.exports = pluginSettings => {
return policyParams => {
const settings = createSettings(pluginSettings, policyParams);
const Integration = settings.useCustomIntegration
? CustomIntegration : ProxyIntegration
return (req, res) => {
getBody(req, res).then(requestBody => {
const options = {
req,
res,
requestBody,
settings
}
Integration.invoke(options);
});
};
};
};