@@ -7,7 +7,6 @@ A super fast, framework agnostic Node.js API Gateway for the masses ❤️
7
7
## Medium articles:
8
8
- https://itnext.io/a-js-api-gateway-for-the-masses-a12fdb9e961c
9
9
10
-
11
10
## Install
12
11
``` js
13
12
npm i fast- gateway
@@ -46,10 +45,10 @@ npm i http-lambda-proxy
46
45
const gateway = require (' fast-gateway' )
47
46
const server = gateway ({
48
47
routes: [{
49
- proxyType: ' lambda' ,
50
48
prefix: ' /service' ,
51
49
target: ' my-lambda-serverless-api' ,
52
- lambdaProxy: {
50
+ proxyType: ' lambda' ,
51
+ proxyConfig: {
53
52
region: ' eu-central-1'
54
53
}
55
54
}]
@@ -104,27 +103,27 @@ module.exports.handler = serverless(service)
104
103
timeout: 0 ,
105
104
// Optional "target" value that overrides the routes "target" config value. Feature intended for testing purposes.
106
105
targetOverride: " https://yourdev.api-gateway.com" ,
106
+ // Optional "Proxy Factory" implementation, allows the integration of custom proxying strategies.
107
+ // Default value: require('fast-proxy-lite/lib/proxy-factory')
108
+ proxyFactory : ({ proxyType, opts, route }) => {... }
107
109
108
110
// HTTP proxy
109
111
routes: [{
110
- // Optional proxy type definition. Supported values: http, lambda
112
+ // Optional proxy type definition. Supported values: http, http-legacy, lambda
113
+ // Modules:
114
+ // - http: fast-proxy-lite
115
+ // - http-legacy: fast-proxy
116
+ // - lambda: http-lambda-proxy
111
117
// Default value: http
112
118
proxyType: ' http'
113
- // Optional `fast-proxy` library configuration (https://www.npmjs.com/package/fast-proxy#options)
114
- // base parameter defined as the route target. Default value: {}
115
- // This settings apply only when proxyType = 'http'
116
- fastProxy: {},
117
- // Optional `http-lambda-proxy` library configuration (https://www.npmjs.com/package/http-lambda-proxy#options)
118
- // The 'target' parameter is extracted from route.target, default region = 'eu-central-1'
119
- // This settings apply only when proxyType = 'lambda'
120
- lambdaProxy: {
121
- region: ' eu-central-1'
122
- },
119
+ // Optional proxy library configuration:
120
+ // - fast-proxy-lite: https://www.npmjs.com/package/fast-proxy-lite#options
121
+ // - fast-proxy: https://www.npmjs.com/package/fast-proxy#options
122
+ // - http-lambda-proxy: https://www.npmjs.com/package/http-lambda-proxy#options
123
+ // Default value: {}
124
+ proxyConfig: {},
123
125
// Optional proxy handler function. Default value: (req, res, url, proxy, proxyOpts) => proxy(req, res, url, proxyOpts)
124
126
proxyHandler : () => {},
125
- // Optional flag to indicate if target uses the HTTP2 protocol. Default value: false
126
- // This setting apply only when proxyType = 'http'
127
- http2: false ,
128
127
// Optional path matching regex. Default value: '/*'
129
128
// In order to disable the 'pathRegex' at all, you can use an empty string: ''
130
129
pathRegex: ' /*' ,
@@ -167,7 +166,7 @@ module.exports.handler = serverless(service)
167
166
// ...
168
167
}
169
168
170
- // if proxyType= 'http', other options allowed https://www.npmjs.com/package/fast-proxy#opts
169
+ // if proxyType= 'http', other options allowed https://www.npmjs.com/package/fast-proxy-lite #opts
171
170
}
172
171
}]
173
172
}
@@ -384,7 +383,7 @@ routes: [{
384
383
385
384
## Related projects
386
385
- middleware-if-unless (https://www.npmjs.com/package/middleware-if-unless )
387
- - fast-proxy (https://www.npmjs.com/package/fast-proxy )
386
+ - fast-proxy-lite (https://www.npmjs.com/package/fast-proxy-lite )
388
387
- http-lambda-proxy (https://www.npmjs.com/package/http-lambda-proxy )
389
388
- restana (https://www.npmjs.com/package/restana )
390
389
@@ -402,4 +401,11 @@ Benchmark scripts can be found in benchmark folder.
402
401
## Support / Donate 💚
403
402
You can support the maintenance of this project:
404
403
- PayPal: https://www.paypal.me/kyberneees
405
- - [ TRON] ( https://www.binance.com/en/buy-TRON ) Wallet: ` TJ5Bbf9v4kpptnRsePXYDvnYcYrS5Tyxus `
404
+ - [ TRON] ( https://www.binance.com/en/buy-TRON ) Wallet: ` TJ5Bbf9v4kpptnRsePXYDvnYcYrS5Tyxus `
405
+
406
+
407
+ ## Breaking Changes
408
+ ### v3.x
409
+ - The ` fast-proxy-lite ` module is used by default to support ` http ` proxy type 🔥. This means, no ` undici ` or ` http2 ` are supported by default.
410
+ - The old ` fast-proxy ` module is available under the ` http-legacy ` proxy type, but the module is not installed by default.
411
+ - Proxy configuration is now generalized under the ` proxyConfig ` property.
0 commit comments