-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (35 loc) · 856 Bytes
/
index.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
exports.handler = async (event) => {
let body;
try {
body = JSON.parse(event.body);
} catch (error) {
return {
statusCode: 400,
body: JSON.stringify({ message: "Invalid request body" }),
};
}
// Extract the category from the request body
const category = body.category;
switch (category) {
case "lite":
return {
statusCode: 200,
body: JSON.stringify({ message: "Lite category" }),
};
case "advance":
return {
statusCode: 200,
body: JSON.stringify({ message: "Advanced category" }),
};
case "dynamic":
return {
statusCode: 200,
body: JSON.stringify({ message: "Dynamic category" }),
};
default:
return {
statusCode: 400,
body: JSON.stringify({ message: "Invalid category" }),
};
}
};