Characteristics of Serverless Apps
We have untangled the knot of definitions around terms like serverless, FaaS and serverless functions. From here on out, with only a few exceptions, we will be talking about the [characteristics of serverless apps](definition-of-serverless apps). (Though we are not particularly picky about distinguishing between serverless apps and serverless functions.)
The main programming model for a serverless app involves writing a short-lived program that will be given one request. Its job is to handle that request, return a response, and quit.
For example, in Spin, it is possible to write HTTP responders without even using any imports. The simplest Swift program, for example, is just this:
When we think about writing serverless apps, we should think in terms of discrete units of functionality (which will become serverless functions), and how these can be grouped into an entire application. For example, the site that runs this guide is running three serverless functions in the serverless app that hosts this website:
- Bartholomew: The CMS that renders pages like this.
- Spin Fileserver: The file serving utility that sends static files like images and CSS.
- Spin Redirect: A simple utility that handles redirects when pages are moved.
Together, these three serverless functions make up the serverless app that runs all of Fermyon.com. (Including our official developer documentation.)Browse Chapters