Updated on 2025-12-10 GMT+08:00
Node.js Function Template
Node.js Function
The following is the sample code template of a Node.js function:
exports.handler = async (event, context) => {
const output =
{
'statusCode': 200,
'headers':
{
'Content-Type': 'application/json'
},
'isBase64Encoded': false,
'body': JSON.stringify(event),
}
return output;
}
When you create an empty Node.js event function on the FunctionGraph console, the preceding sample code is deployed by default.
Helpful Links
- For details about how to use Node.js to develop an event function, see Developing a Node.js Event Function.
- For details about how to use Node.js to develop an HTTP function, see Developing an HTTP Function Using Node.js.
- For details about how to create a dependency package for a Node.js function, see Creating a Dependency for a Node.js Function.
- For more information about function development, such as the supported runtimes, trigger events, function project packaging specifications, and DLL referencing, see Function Development Overview.
Parent topic: Node.js
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot