...

/

Anatomy of a Project and Basic CLI Commands

Anatomy of a Project and Basic CLI Commands

Become familiar with the anatomy of the Serverless Framework.

We'll cover the following...

In this lesson, we'll explore the anatomy of a Serverless Framework project using a construction analogy to help newcomers better understand the components and structure of a typical project. Let's compare a Serverless Framework project to building a house. Imagine constructing a house, where various elements like the foundation, walls, and roof come together to create a solid structure. Similarly, a Serverless Framework project has different components, each with a unique role in the overall structure and functionality.

The heart of every Serverless Framework project is the serverless.yml file. It acts as the blueprint, defining the structure and components of our serverless application.

Here's a basic example of a serverless.yml file:

Press + to interact
service: my-house
provider:
name: aws
runtime: nodejs16.x
stage: dev
region: us-west-2
functions:
processOrder:
handler: handlers/order.handler
events:
- http:
path: request
method: get

Now, let's break down the main elements in our serverless.yml file using the construction (a house) analogy:

Service (house name): The service section represents the name of our house. It helps to identify and group our project resources when deploying to the cloud provider. In our example, the ...