-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhandler.js
More file actions
27 lines (22 loc) · 682 Bytes
/
handler.js
File metadata and controls
27 lines (22 loc) · 682 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
'use strict';
const axios = require('axios');
module.exports.run = (event, context, callback) => {
const time = new Date();
console.log(`Your cron function "${context.functionName}" ran at ${time}`);
const config = {}
if (process.env.JWT_TOKEN) {
config.headers = {
'Authorization': `Bearer ${process.env.JWT_TOKEN}`
}
}
console.log(`calling ${process.env.URL}`)
axios.get(process.env.URL, config)
.then(function () {
console.log('ok');
callback(null, 'ok')
})
.catch(function (error) {
console.log(error);
callback(error)
});
};