Skip to Content
Learning Apache OpenWhisk
book

Learning Apache OpenWhisk

by Michele Sciabarrà
July 2019
Intermediate to advanced
391 pages
8h 40m
English
O'Reilly Media, Inc.
Content preview from Learning Apache OpenWhisk

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

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning Docker

Learning Docker

Rick Fast
Apache Cookbook, 2nd Edition

Apache Cookbook, 2nd Edition

Rich Bowen, Ken Coar

Publisher Resources

ISBN: 9781492046158Errata Page