This topic describes handlers and how to configure handlers in a Node.js runtime environment of Function Compute.

What is a handler?

A handler of a function in FC is a method that is used to process requests in the function code. When you invoke a function in FC, Function Compute uses the handler that you configured to process requests. You can configure a handler for a function by setting the Request Handler parameter in the Function Compute console.

For FC functions in Node.js, the handler must be in the File name.Method name format. For example, if your file name is main.js and your method name is handler, the handler is main.handler.

For more information about the definitions and related operations of functions in FC, see Manage functions.

Configure a handler

When you configure a handler, make sure that you follow the configuration specifications that are described in Function Compute. The configuration specifications vary based on the handler type.

Handlers are classified into event handlers and HTTP handlers. Event requests are generated by event sources, and HTTP requests are generated by HTTP triggers. For more information, see Function types.

For more information about how to configure a handler, see Event handler and HTTP handler.


For more information about how to deploy your code to Function Compute, see Deploy a code package.