A Bluemix hosted Openwhisk NodeJS API. Go Serverless!!
JavaScript HTML CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
public
views
.gitignore
CHANGELOG.md
README.md
app.js
manifest.yml
npm-debug.log
package.json

README.md

Node.js OpenWhisk REST API

The API demonstrates a simple, reusable Node.js web application based on the Express framework that interacts with OpenWhisk APIs and provides an API to list and Invoke actions,Packages and API gateway routes. The app extensively uses JavaScript client library(npm package) for the OpenWhisk platform.

OpenWhisk is a serverless platform that lets developers quickly and easily build feature-rich apps that automatically trigger responses to events.

Prerequisites

  1. Bluemix account.
  2. OpenWhisk CLI.
  3. Cloudfoundry or Bluemix CLI.

Getting Started

  • Don’t have Bluemix account? Sign up to create a free trial account.
  • Have a Bluemix account? Use this link.

Develop in your Browser

Try out OpenWhisk in your Browser to create actions, automate actions using triggers, and explore public packages. Visit the learn more page for a quick tour of the OpenWhisk User Interface.

Setting up the OpenWhisk CLI

You can use the OpenWhisk command line interface (CLI) to set up your namespace and authorization key. Go to Configure CLI and follow the instructions to install it.

Run the app locally

git clone https://github.com/VidyasagarMSC/openwhisk-nodejs-api.git
  • cd into the app directory
  • Run npm install to install the app's dependencies
  • Open manifest.yml file and provide a unique name,host.
  • Create a newfile and save it as .env in the root of the folder.Add the below values to .env file and save
 OpenWhisk_HOST = "openwhisk.ng.bluemix.net"
 OpenWhisk_AuthKey=" "


For OpenWhisk auth key, run the below command

wsk property get --auth

Push to Bluemix

  • Go to the root of the folder on your terminal, run the below command
cf push
  • Based on the artifacts in your manifest.yml file, NodeJS runtime is created and you can see your app running on the host your provided.

Test REST API

  • GET /api/v1/invoke/action/{actionName} followed by simple query
  • POST /api/v1/invoke/action/{actionName} with a POST body eg., {"message":"test"}
  • POST /api/v1/invoke/trigger/{triggerName} with a POST body (if any)
  • GET /api/v1/list/{entity} entity = actions or packages or triggers or namespaces or activations or rules or routes