concept API Gateway in category node

appears as: API Gateway, n API Gateway
Serverless Applications with Node.js

This is an excerpt from Manning's book Serverless Applications with Node.js.

  • API Gateway is a router that accepts HTTP requests and invokes other services depending on the routes.
  • 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.

    Listing 2.2 Deploying an API to AWS Lambda and API Gateway using Claudia
    claudia create \    #1  
      --region eu-central-1 \    #2  
      --api-module api    #3  
    
      #1   Create and deploy a new Lambda function.
      #2   Select the region where you want your function to be deployed.
      #3   Tell Claudia that you are building an API and that your API’s entry point is api.js.

    As you can see in figure 2.5, API Gateway acts like a router or a traffic controller. It accepts HTTP requests (such as Pizza API requests from your web or mobile application), parses them to a common format, and routes them to one of your connected AWS services.

    Figure 2.5 API Gateway routes requests to your AWS services.

    figure-2.5.eps

    API Gateway can be integrated with many AWS services, including AWS Lambda and Amazon S3. Each API on API Gateway can be connected to multiple services. For example, certain routes can invoke Lambda functions, whereas others can interact with some other service.

    API Gateway offers another approach to HTTP request routing, called a proxy router. Instead of creating each route, a proxy router sends all requests to a single AWS Lambda function. This approach can be useful when you are creating a small API or when you want to speed up your deployment, because creating and updating multiple routes on API Gateway can take a few minutes, depending on your internet connection speed and the number of routes.