You can configure multiple Edge Compute functions within your service. Each function is associated with a list of routes, where each route consists of a domain and a path pattern.
To Add an Edge Compute Function to Your Service #
- Navigate to your service.
- In the sidebar, select Edge Compute.
- Click the New button.
- Complete the new Edge Compute form:
- Name – Enter a name for the new Edge Compute function.
- Stages – Select the stage or stages of the request flow where the code should run:
- On Request – Triggered when the incoming HTTP request reaches the edge.
- On Response – Triggered after a response is generated but before it is returned to the end user.
- Code – Provide the code you want to deploy. For more details, refer to the Developer Guide.
- Add Route – Specify the routes (domain + path pattern) where the function should apply. Examples:
a.example.com/api/*– Applies the code to all requests under the domaina.example.comthat match the path pattern/api/*.*/blogs/*– Applies the code to all service domains for requests matching the path pattern/blogs/*.
Once created, the new Edge Compute function will appear in the list and take effect immediately.