📎 Webclip
How to develop locally using serverless offline
The article explains that serverless-offline lets Node.js developers emulate AWS Lambda and API Gateway on a local machine, so they can test changes without deploying every time. It says this improves logs, debugging, and team workflow, while keeping development local or in a shared environment.
Reading notes#
- The plugin starts a local HTTP server that handles request lifecycles and invokes handlers.
- The setup adds the serverless-offline package to a Node.js project and registers it in serverless.yml.
- Running
serverless offlinestarts a local server that emulates AWS Lambda and API Gateway. - An
.envflag such asIS_OFFLINEcan switch a Lambda client between a local endpoint and an AWS endpoint. - The article shows invoking a Lambda locally with the AWS CLI against
http://localhost:3002. - The plugin provides a CLI with many options for ports, CORS, HTTPS, Docker, WebSocket settings, and other local configuration.
- The same options can also be set in
serverless.yml, and CLI values override the file values. - The guide then walks through creating a Fauna database, generating a security key, and creating an AWS Lambda function that queries a Fauna collection.
- The example uses the
faunadbpackage, a client configured with the database secret, and a query againstindexes/all_customers. - The article closes by describing Fauna as a secure, scalable cloud API with native GraphQL and support for serverless, multiregional use.
