2 Building your first serverless API

 

This chapter covers

  • Creating and deploying an API using Claudia
  • How Claudia deploys an API to AWS
  • How API Gateway works

The main goal of this chapter for you is to build your first serverless API with Claudia and deploy it to AWS Lambda and API Gateway. You’ll also see the differences between a traditional and a serverless application structure and gain a better grasp of Claudia as you learn what Claudia is doing under the hood. To get the most from this chapter, you should understand the basic concepts of serverless described in chapter 1.

2.1 Assembling pizza ingredients: building the API

Your Aunt Maria is happy and grateful that you are going to help her get back on her feet. She even made you her famous pepperoni pizza! (Try not to be hungry at this moment!)

Aunt Maria already has a website, so you will build a back-end application—more precisely, an API—to enable her customers to preview and order pizzas. The API will be responsible for serving pizza and order information, as well as handling pizza orders. Later, Aunt Maria would also like to add a mobile application, which would consume your API services.

To start gently, the first API endpoints will handle some simple business logic and return static JSON objects. You can see the broad overview of your initial application structure in figure 2.1. The figure also shows the crude HTTP requests flow through your API.

Figure 2.1 A broad overview of the Pizza API you will build in this chapter

figure-2.1.eps

2.1.1 Which pizza can I GET?

 

2.1.2 Structuring your API

 
 

2.1.3 POSTing an order

 
 
 

2.2 How Claudia deploys your API

 
 
 

2.3 Traffic control: How API Gateway works

 
 
 
 

2.4 When a serverless API is not the solution

 
 

2.5 Taste it!

 
 
 

2.5.1 Exercise

 
 
 
 

2.5.2 Solution

 
 
 

Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest