Initialize the directory for the Lambda function

To begin, create and initialize the directory for your Lambda function:

mkdir titan-schools-lambda
cd titan-schools-lambda
npm init -y
npm install axios

Code for index.js

This is the main code for your index.js file:

The MMM used Axios, so i went with that, there may be an easier way.

Copy code
const axios = require('axios');

exports.handler = async (event) => {
const buildingId = '<your buildingID>';
const districtId = '<your districtID>';

const formatDate = (dateObject) => {
return `${dateObject.getMonth() + 1}-${dateObject.getDate()}-${dateObject.getFullYear()}`;
};

const today = new Date();
const startDate = formatDate(today);

const params = {
buildingId,
districtId,
startDate,
};

try {
const response = ...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help