lambda-request-handler
Advanced tools
Comparing version 0.4.4 to 0.5.0
@@ -17,3 +17,3 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
@@ -20,0 +20,0 @@ return result; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { RequestListener } from 'http'; | ||
@@ -16,3 +17,4 @@ import * as apigw from './types'; | ||
nestHandler: (nestApp: any) => Promise<any>; | ||
fastifyHandler: (fastifyBuilder: (options: object) => any) => (options: object) => Promise<RequestListener>; | ||
}; | ||
export = handler; |
@@ -46,2 +46,3 @@ "use strict"; | ||
handler.nestHandler = in_process_request_1.default.nestHandler; | ||
handler.fastifyHandler = in_process_request_1.default.fastifyHandler; | ||
module.exports = handler; |
{ | ||
"name": "lambda-request-handler", | ||
"version": "0.4.4", | ||
"version": "0.5.0", | ||
"license": "(MIT OR Apache-2.0)", | ||
@@ -28,2 +28,4 @@ "scripts": { | ||
"connect", | ||
"apollo", | ||
"fastify", | ||
"http", | ||
@@ -40,4 +42,4 @@ "request", | ||
"dependencies": { | ||
"in-process-request": "^0.2.1", | ||
"isutf8": "^3.0.0" | ||
"in-process-request": "^0.3.0", | ||
"isutf8": "^3.1.1" | ||
}, | ||
@@ -47,14 +49,14 @@ "devDependencies": { | ||
"@types/cookie-parser": "^1.4.2", | ||
"@types/express": "^4.17.6", | ||
"@types/jest": "^25.2.3", | ||
"@types/node": "^14.0.4", | ||
"@types/express": "^4.17.8", | ||
"@types/jest": "^26.0.15", | ||
"@types/node": "^14.14.6", | ||
"compression": "^1.7.4", | ||
"cookie-parser": "^1.4.5", | ||
"ejs": "^3.1.3", | ||
"ejs": "^3.1.5", | ||
"express": "^4.17.1", | ||
"jest": "^26.0.1", | ||
"ts-jest": "^26.0.0", | ||
"ts-node": "^8.10.1", | ||
"typescript": "^3.9.3" | ||
"jest": "^26.6.3", | ||
"ts-jest": "^26.4.3", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.5" | ||
} | ||
} |
@@ -13,5 +13,8 @@ # lambda-request-handler | ||
* Hapi v19 (only supported in `nodejs12.x` runtime) | ||
* Hapi v20 (only supported in `nodejs12.x` runtime) | ||
* NestJS v7 | ||
* Connect v3 | ||
* Koa v2 | ||
* Polka | ||
* Fastify v3 | ||
@@ -179,1 +182,24 @@ Inspired by [aws-serverless-express](https://github.com/awslabs/aws-serverless-express) | ||
If the above file in your Lambda source was called `index.ts`, compiled to `index.js` then the name of the handler in the Lambda configuration is `index.handler` | ||
### Polka | ||
```javascript | ||
const polka = require('polka') | ||
const lambdaRequestHandler = require('lambda-request-handler') | ||
const app = polka() | ||
app.get('/user/:id', (req, res) => { | ||
res.json({ | ||
id: req.params.id, | ||
lambdaRequestId: req.header('x-aws-lambda-request-id') | ||
name: 'John' | ||
}) | ||
}) | ||
const handler = lambdaRequestHandler(app.handler.bind(app)) | ||
module.exports = { handler } | ||
``` | ||
If the above file in your Lambda source was called `index.js` then the name of the handler in the Lambda configuration is `index.handler` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28980
337
204
+ Addedin-process-request@0.3.1(transitive)
- Removedin-process-request@0.2.1(transitive)
Updatedin-process-request@^0.3.0
Updatedisutf8@^3.1.1