OpenWhisk | Simple Function Example

This example demonstrates a simple example in NodeJS.

user  

James Thomas

Clone This Example

Step #1 -
npm install serverless -g
Step #2 -
serverless install -u https://github.com/serverless/examples/tree/master/openwhisk-node-simple -n  openwhisk-node-simple

Serverless Boilerplate - OpenWhisk - Node.js

Make sure serverless is installed. See installation guide.

You will also need to set up your OpenWhisk account credentials using environment variables or a configuration file. Please see the this guide for more information.

1. Install Provider Plugin & Service Dependencies

npm install in this directory to download the modules from package.json.

2. Deploy

serverless deploy or sls deploy. sls is shorthand for the Serverless CLI command

3. Invoke deployed function

serverless invoke --function hello_world or serverless invoke -f hello_world

-f is shorthand for --function

In your terminal window you should see the response from Apache OpenWhisk

{
    "payload": "Hello, World!"
}

Congrats you have just deployed and run your Hello World function!

For more information on the Serverless OpenWhisk plugin, please see the project repository: https://serverless.com/framework/docs/providers/openwhisk/guide/credentials/.

Latest commit b2f54ec on Sep 24, 2017

New to serverless?

To get started, pop open your terminal & run:

npm install serverless -g