School Lunch LINQ Connect integration · dakboard/Cloud-Platform · Discussion #1913
github.com·1d
🔌API Development
Preview
Report Post

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...