Cloudflare Workers - HTTP Events

Serverless Yml

When creating a service your serverless yml will define which endpoint is used for your function and when you run the serverless invoke command.

# serverless.yml
    # What the script will be called on Cloudflare (this property value must match the function name one line above)
    name: helloWorld
    # The name of the script on your machine, omitting the .js file extension
    script: helloWorld
      - http:
          method: GET
            greeting: hi

The events section in the yml above makes it so that the Function helloWorld will be used for request to the endpoint. This configuration would send a GET request with a header called greeting that has a value of hi to the endpoint when you run serverless invoke -f helloWorld.

Go to Github