'use strict';exports.main_handler = async (event, context) => {console.log(process.env)console.log(process.env.SCF_RUNTIME)return "Hello world"};
moment library to obtain the local time, and provides a time formatted output method to output date and time in the specified format.TZ=Asia/Shanghai environment variable to the function.'use strict';const moment = require('moment')exports.main_handler = async (event, context) => {let currentTime = moment(Date.now()).format('YYYY-MM-DD HH:mm:ss')console.log(currentTime)return "hello world"};
npm install request command under the project directory to install this dependent library.'use strict';var request = require('request');exports.main_handler = async (event, context) => {request('https://cloud.tencent.com/', function (error, response, body) {if (!error && response.statusCode == 200) {console.log(body) // Processing logic for successful request}})return "success"};
Doc Feedback