Skip to content

Instantly share code, notes, and snippets.

@wallabyway
Created April 29, 2024 20:50
Show Gist options
  • Save wallabyway/9c33008950ab1225c70da644e8a8df71 to your computer and use it in GitHub Desktop.
Save wallabyway/9c33008950ab1225c70da644e8a8df71 to your computer and use it in GitHub Desktop.
Tandem Connect - code block support for ES6, async/await and modules, anti lint
/* jshint esversion: 8 */
'use strict'
const axios = require('axios');
/**
* Handler function that will process the data and return a result.
*
* @param {Object} data - Data to be processed.
* @param {Objcct} logger - Can be used for any logging purposes.
* @param {Function} logger.log - Use to log anything i.e. logger.log(Object | String)
*/
exports.handle = async function (data, logger) {
// TODO: Process the data here. You may return a value, or a Promise.
logger.log(data);
const res = await axios.get("https://www.7timer.info/bin/civillight.php", {
params: {
lon: -122.4,
lat: 37.8,
ac: 0,
unit: 'metric',
output: 'json',
tzshift: 0
}
});
logger.log(res.data);
return res.data;
}
{
"esversion": 8,
"name": "package name",
"version": "1.0.0",
"dependencies": {
"axios": "^0.21.1"
}
}
@wallabyway
Copy link
Author

Screenshot 2024-04-29 at 1 51 21 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment