mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
added aws lambda adapter + improvements to handle concurrency
This commit is contained in:
31
examples/aws-lambda/test.js
Normal file
31
examples/aws-lambda/test.js
Normal file
@@ -0,0 +1,31 @@
|
||||
require("dotenv").config();
|
||||
const handler = require("./dist/index.js").handler;
|
||||
|
||||
const event = {
|
||||
httpMethod: "GET",
|
||||
path: "/",
|
||||
//path: "/api/system/config",
|
||||
//path: "/assets/main-B6sEDlfs.js",
|
||||
headers: {
|
||||
//"Content-Type": "application/json",
|
||||
"User-Agent": "curl/7.64.1",
|
||||
Accept: "*/*",
|
||||
},
|
||||
};
|
||||
|
||||
const context = {
|
||||
awsRequestId: "mocked-request-id",
|
||||
functionName: "myMinimalLambda",
|
||||
functionVersion: "$LATEST",
|
||||
memoryLimitInMB: "128",
|
||||
getRemainingTimeInMillis: () => 5000,
|
||||
};
|
||||
|
||||
// Execute the handler
|
||||
handler(event, context)
|
||||
.then((response) => {
|
||||
console.log(response.statusCode, response.body);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error:", error);
|
||||
});
|
||||
Reference in New Issue
Block a user