-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlambda.js
More file actions
32 lines (27 loc) · 875 Bytes
/
Copy pathlambda.js
File metadata and controls
32 lines (27 loc) · 875 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
28
29
30
31
32
const astroreha = require("astroreha");
async function handler(event, context) {
try {
const body = JSON.parse(event.body);
const { dateString, timeString, lat, lng, timezone } = body.firstPerson;
const birthChart = astroreha.positioner.getBirthChart(
dateString, timeString, lat, lng, timezone
);
return {
statusCode: 200,
body: JSON.stringify({
message: "Here is your birthChart",
success: true,
birthChart,
houses: astroreha.compatibility.getHousesOfChart(birthChart),
navamsa: astroreha.positioner.getNavamsaChart(birthChart),
nakshatra: astroreha.compatibility.calculateNakshatra(birthChart),
}),
};
} catch (error) {
return {
statusCode: 500,
body: JSON.stringify({ message: "Error", error: error.message }),
};
}
}
exports.handler = handler;