Created
April 29, 2024 20:50
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"esversion": 8, | |
"name": "package name", | |
"version": "1.0.0", | |
"dependencies": { | |
"axios": "^0.21.1" | |
} | |
} |
Author
wallabyway
commented
Apr 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment