-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler.ts
More file actions
27 lines (24 loc) · 820 Bytes
/
handler.ts
File metadata and controls
27 lines (24 loc) · 820 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
import {APIGatewayProxyEvent, APIGatewayProxyResult} from "aws-lambda";
import {generateImage} from "./generator";
export const generate = async (
event: APIGatewayProxyEvent
): Promise<APIGatewayProxyResult> => {
const query = event.queryStringParameters;
const buffer = await generateImage({
userId: query['userId'],
diseaseName: query['diseaseName'],
vaccinationName: query['vaccinationName'],
inoculationDate: query['inoculationDate'],
cardImageUrl: query['cardImageUrl'],
maskImageUrl: query['maskImageUrl'],
iconImageUrl: query['iconImageUrl'],
})
return {
statusCode: 200,
headers: {
"Content-Type": "image/png",
},
isBase64Encoded: true,
body: buffer.toString('base64'),
};
};