Skip to main content
The http worker turns your functions into REST routes exposed as HTTP endpoints.

Before adding the worker

compose::add is served by a running Compose daemon. Keep the engine and a daemon for this project running in separate terminals before using any of the commands below. If this project does not have a Compose file yet, create worker-compose.yaml containing containers: {} first.
iii compose without a subcommand starts the Compose daemon. --namespace selects its namespace, and --engine connects it to the existing engine. These options are listed in the generated CLI reference. Run the remaining commands from a third terminal in that same project directory:
This page covers the basic endpoint flow. For path patterns, methods, headers, and response handling, see the http worker docs. The worker’s server settings (port, host, CORS, timeouts) are managed at runtime through the configuration worker.

Create endpoints

The http worker exposes an http trigger type that binds a function to an HTTP method and path; the function then runs on every matching request. Here is the full path from a running engine to a live endpoint.
registerTrigger is deprecated in 0.25, but the http worker still publishes the http trigger type, so it remains the way to create endpoints. It logs one warning per process. See Providers not migrated yet.
  1. In a worker, register the function you want to expose and bind an http trigger to it. If you do not have a worker yet, follow Create a new worker, then edit its source. The handler receives the request (body, headers, method) and its return value becomes the response:
The Rust SDK sets the worker name through InitOptions.metadata.name; Node uses workerName, and Python uses worker_name. All three examples register the name my-worker.
  1. Add the worker to Compose, pointing at its directory:
For path patterns, request and response shapes, and the other configuration options, see the http worker docs.

Calling the endpoint

Once the trigger is registered, set HTTP_WORKER_URL to the address configured for the http worker and call the endpoint: