Triggers

Fleet functions can be triggered via HTTP REST requests, each project is receive a unique subdomain that can be used to trigger the functions.

Configuration

In the configuration of the fleet.yml file, this is where you tell Fleet how it will trigger its function.

functions:
  apiAuth:
    handler: 'index.js'
    http:
      method: ['GET']
      path: '/v1/auth'

The path and method are the main criteria for deciding which function Fleet will trigger, the path can be a static or dynamic value, using the proxy features:

  • Define :proxy+ for your function to handle any requests in this path. (e.g /v1/user/:proxy+)
  • Set :userId for your function to handle only this dynamic path. (e.g /v1/posts/:id)

A function can handle several methods as well, you can define the following available:

  • GET
  • POST
  • PUT
  • PATCH
  • HEAD
  • OPTIONS
  • DELETE
method: ['GET', 'POST', 'PUT']