You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/03/15 04:41:10 UTC

[GitHub] [incubator-openwhisk] rabbah opened a new issue #4349: override action entry point on web action invoke

rabbah opened a new issue #4349: override action entry point on web action invoke
URL: https://github.com/apache/incubator-openwhisk/issues/4349
 
 
   When one creates an action, they can specify the main entry point. For example
   ```
     wsk action create myfn f.js --main foo
   ```
   
   This allows a single file with multiple functions to be used as different actions.
   
   But this is wasteful - one has to create multiple actions this way and we're paying the cost in the backend by replicating the code.
   
   What if the `main` was specified on invoke instead? For example, take a web action from this file `hello.js`
   
   ```js
   function niam(args) { return { 'greetings': 'Hello from a non-standard entrypoint.' } }
   function main(args) { return { 'greetings': 'Hello from a standard entrypoint.' } }
   ```
   
   ```
     wsk action create hello --web true hello.js
   ```
   
   We could allow `main` to be set on the action activation. 
   
   ```
   > curl -k https://guest.localhost/default/hello.json
   {
     "greetings": "Hello from a standard entrypoint."
   }
   ```
   
   And now with an override to "main", using `@<new main>` as the new entry point.
   
   ```
   > curl -k https://guest.localhost/default/hello.json@niam
   {
     "greetings": "Hello from a non-standard entrypoint."
   }
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services