Skip to content

Instantly share code, notes, and snippets.

@ssx
Last active July 28, 2018 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssx/e7616236e8c242a0a11a04f49b379a78 to your computer and use it in GitHub Desktop.
Save ssx/e7616236e8c242a0a11a04f49b379a78 to your computer and use it in GitHub Desktop.
<?php
function main(array $args) : array
{
$name = $args['name'] ?? 'stranger';
$greeting = 'Hello '.$name.'!';
return [
'statusCode' => 201,
'headers' => [
'X-Header-Test' => 'Something shiny',
],
'body' => [
'input' => $args,
'greeting' => $greeting
]
];
}
function other(array $args) : array
{
$name = $args['name'] ?? 'stranger';
$greeting = 'Hello other '.$name.'!';
return [
'statusCode' => 200,
'body' => [
'input' => $args,
'greeting' => $greeting
]
];
}
# Upload with:
# wsk action create greeting greeting.php --web true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment