Help Center/ FunctionGraph/ Developer Guide/ Node.js/ Node.js Function Template
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