This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-website.git
The following commit(s) were added to refs/heads/master by this push:
new 5473369 Update example (#445)
5473369 is described below
commit 5473369ad59d8238760018cc801a574e0dde8951
Author: yadwinder singh <[email protected]>
AuthorDate: Fri Sep 18 11:15:01 2020 -0400
Update example (#445)
* Changes:
- Update nodejs client examples
- Update invoke action commands to use common flags for all examples
Co-authored-by: Yadwinder <[email protected]>
---
_includes/code/hello.js | 7 ++++---
_includes/code/manifest-for-helloJS-2.yaml | 5 +++--
_layouts/documentation.html | 24 ++++++++++--------------
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/_includes/code/hello.js b/_includes/code/hello.js
index 685fd4e..3653f77 100644
--- a/_includes/code/hello.js
+++ b/_includes/code/hello.js
@@ -1,3 +1,4 @@
-function main() {
- return {payload: 'Hello world'};
-}
+function main(args) {
+ const name = args && args.name || "stranger";
+ return { greeting: `Hello ${name}!` };
+}
\ No newline at end of file
diff --git a/_includes/code/manifest-for-helloJS-2.yaml
b/_includes/code/manifest-for-helloJS-2.yaml
index a1e0bc0..64d7d1e 100644
--- a/_includes/code/manifest-for-helloJS-2.yaml
+++ b/_includes/code/manifest-for-helloJS-2.yaml
@@ -3,8 +3,9 @@ packages:
actions:
helloJS:
code: |
- function main() {
- return {payload: 'Hello world'};
+ function main(args) {
+ const name = args && args.name || "stranger";
+ return { greeting: `Hello ${name}!` };
}
runtime: nodejs:10
diff --git a/_layouts/documentation.html b/_layouts/documentation.html
index e17dc07..f71d369 100644
--- a/_layouts/documentation.html
+++ b/_layouts/documentation.html
@@ -872,18 +872,14 @@ $ wsk list -v
</div>
</li>
<li style="list-style-type: decimal">
- Invoke the <i>helloJS</i> action as a blocking activation:
+ Invoke an action <i>helloJS</i>:
<div class="terminal">
-{% highlight bash %}$ wsk action invoke helloJS --blocking{% endhighlight %}
+{% highlight bash %}$ wsk action invoke helloJS --result --param name World{%
endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
{
-"result": {
-"payload": "Hello world"
-},
-"status": "success",
-"success": true
+ "greeting": "Hello World!"
}{% endhighlight %}
</div>
</li>
@@ -988,7 +984,7 @@ $ wsk list -v
<li style="list-style-type: decimal">
Invoke an action <i>helloGo</i>:
<div class="terminal">
-{% highlight bash %}$ wsk action invoke helloGo -r -p name gopher{%
endhighlight %}
+{% highlight bash %}$ wsk action invoke helloGo --result --param name gopher{%
endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
@@ -1087,7 +1083,7 @@ $ wsk list -v
</li>
<li style="list-style-type: decimal">Invoke the <i>helloPy</i>
action using command-line parameters:
<div class="terminal">
-{% highlight bash %}$ wsk action invoke helloPy --blocking --param name
World{% endhighlight %}
+{% highlight bash %}$ wsk action invoke helloPy --result --param name World{%
endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
@@ -1212,7 +1208,7 @@ $ javac --release 8 Hello.java
<li style="list-style-type: decimal">
Invoke an action <i>helloJava</i>:
<div class="terminal">
-{% highlight bash %}$ wsk action invoke helloJava --blocking --result{%
endhighlight %}
+{% highlight bash %}$ wsk action invoke helloJava --result{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
@@ -1290,7 +1286,7 @@ $ javac --release 8 Hello.java
<li style="list-style-type: decimal">
Invoke an action <i>helloPHP</i>:
<div class="terminal">
-{% highlight bash %}$ wsk action invoke helloPHP --blocking --result --param
name World{% endhighlight %}
+{% highlight bash %}$ wsk action invoke helloPHP --result --param name World{%
endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
@@ -1396,7 +1392,7 @@ $ javac --release 8 Hello.java
<li style="list-style-type: decimal">
Invoke an action <i>hello_ruby</i>:
<div class="terminal">
-{% highlight bash %}$ wsk action invoke hello_ruby --blocking --result --param
name World{% endhighlight %}
+{% highlight bash %}$ wsk action invoke hello_ruby --result --param name
World{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
@@ -1493,7 +1489,7 @@ $ javac --release 8 Hello.java
<li style="list-style-type: decimal">
Invoke an action <i>helloSwift</i>:
<div class="terminal">
-{% highlight bash %}$ wsk action invoke helloSwift -r -p name Carlos{%
endhighlight %}
+{% highlight bash %}$ wsk action invoke helloSwift --result --param name
Carlos{% endhighlight %}
</div>
<div class="terminal">
{% highlight yaml %}
@@ -1638,7 +1634,7 @@ $ wsk action create helloDotNet helloDotNet.zip --main
Apache.OpenWhisk.Example.
Invoke an action <i>helloDotNet</i>:
<div class="terminal">
{% highlight bash %}
-$ wsk action invoke helloDotNet -r -p name Shawn
+$ wsk action invoke helloDotNet --result --param name Shawn
{% endhighlight %}
</div>
<div class="terminal">