Chapter 2. A Simple OpenWhisk Application
This chapter walks through developing a simple OpenWhisk application using the CLI and JavaScript as a programming language. The goal is to show you how serverless development works in action. For this purpose, we are going to create a simple contact form for a website using OpenWhisk.
Note
Apache OpenWhisk is an open source project that is meant to be cloud-independent; you can adopt it without being constrained to one single vendor.
Let’s assume you already have a static website and you want to add a contact form. The challenge here is that you cannot store contacts in your static website; you need some server logic to save them. Furthermore, you may want some logic to validate the data (since users can disable JavaScript in their browsers) and additionally receive email notification of what is going on on the website.
Since you cannot do this with just static HTML, this is a good use case for OpenWhisk: implementing simple external logic for an otherwise static website. For simplicity, our examples refer to the IBM Cloud, which offers OpenWhisk as its “Cloud Functions” service. However, the techniques here can be used with other cloud providers that support OpenWhisk.
Tip
The source code for the examples in this chapter is available on GitHub.
Getting Started
We’re assuming that you already have a website, built with a static website generator. Even so, not everything on a website can be static. For example, you may need to allow ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access