Skip to content

Your first Handler

Run a small function, deploy it, and inspect the result.

Applies to
CLIConsole

Verified · v1.4.16

Markdown

Sign in, then save this as handler.js:

export default async function (event) {
  return { message: `Hello, ${event.name ?? 'Wings'}` }
}

Run without deploying

wings run --file handler.js --event '{"name":"Wings"}'

The result should contain message: "Hello, Wings". This command runs the code in the cloud too.

Deploy a Handler

wings handler deploy --name hello --file handler.js
wings handler list

Replace <handler-id> below with the ID shown in the list:

wings run <handler-id> --event '{"name":"Wings"}'
wings handler logs <handler-id>

You should get the same Hello, Wings result and a successful Run. You can also inspect the Handler and its Runs in the Console.

Set up a Connection to call an external API. Add a Schedule to run the Handler regularly.