-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlambda.js
26 lines (24 loc) · 951 Bytes
/
lambda.js
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
// see: https://github.com/fastify/aws-lambda-fastify
const awsLambdaFastify = require("@fastify/aws-lambda");
const app = require("./app");
const proxy = awsLambdaFastify(app);
// or
// const proxy = awsLambdaFastify(app, { binaryMimeTypes: ["application/octet-stream"], serializeLambdaArguments: false /* default is true */ });
// exports.handler = proxy;
// or
// exports.handler = (event, context, callback) => proxy(event, context, callback);
// or
// exports.handler = (event, context) => proxy(event, context);
// or
// exports.handler = async (event, context) => proxy(event, context);
exports.handler = async (event, context, callback) => {
const response = await proxy(event, context, callback);
// const response = {
// statusCode: 200,
// headers: {
// 'Content-Type': 'text/html',
// },
// body: JSON.stringify(context),
// };
callback(null, response); // sending HTML back
}