# serverless-offline **Repository Path**: mirrors_stevemao/serverless-offline ## Basic Information - **Project Name**: serverless-offline - **Description**: Emulate AWS λ and API Gateway locally when developing your Serverless project - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-26 - **Last Updated**: 2025-09-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Serverless Offline Plugin [![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com) [![npm version](https://badge.fury.io/js/serverless-offline.svg)](https://badge.fury.io/js/serverless-offline) [![Build Status](https://travis-ci.org/dherault/serverless-offline.svg?branch=master)](https://travis-ci.org/dherault/serverless-offline) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing) This [Serverless](https://github.com/serverless/serverless) plugin emulates AWS λ and API Gateway on your local machine to speed up your development cycles. To do so, it starts an HTTP server that handles the request's lifecycle like APIG does and invokes your handlers. **Features:** * Node.js λ only. * Velocity templates support. * Lazy loading of your files with require cache invalidation: no need for a reloading tool like Nodemon. * And more: integrations, authorizers, proxies, timeouts, responseParameters, HTTPS, Babel runtime, CORS, etc... This plugin is updated by its users, I just do maintenance and ensure that PRs are relevant to the community. In other words, if you [find a bug or want a new feature](https://github.com/dherault/serverless-offline/issues), please help us by becoming one of the [contributors](https://github.com/dherault/serverless-offline/graphs/contributors) :v: ! See the [contributing section](#contributing). We are looking for maintainers, see [this issue](https://github.com/dherault/serverless-offline/issues/304). ## Documentation * [Installation](#installation) * [Usage and command line options](#usage-and-command-line-options) * [Usage with Babel](#usage-with-babel) * [Token authorizers](#token-authorizers) * [Custom authorizers](#custom-authorizers) * [Remote authorizers](#remote-authorizers) * [AWS API Gateway features](#aws-api-gateway-features) * [Velocity nuances](#velocity-nuances) * [Debug process](#debug-process) * [Scoped execution](#scoped-execution) * [Simulation quality](#simulation-quality) * [Credits and inspiration](#credits-and-inspiration) * [Contributing](#contributing) * [License](#license) ## Installation For Serverless v1 only. See [this branch](https://github.com/dherault/serverless-offline/tree/serverless_0.5) for 0.5.x versions. First, add Serverless Offline to your project: `npm install serverless-offline --save-dev` Then inside your project's `serverless.yml` file add following entry to the plugins section: `serverless-offline`. If there is no plugin section you will need to add it to the file. It should look something like this: ```YAML plugins: - serverless-offline ``` You can check wether you have successfully installed the plugin by running the serverless command line: `serverless` the console should display _Offline_ as one of the plugins now available in your Serverless project. ## Usage and command line options In your project root run: `serverless offline start` or `sls offline start`. to list all the options for the plugin run: `sls offline --help` All CLI options are optional: ``` --prefix -p Adds a prefix to every path, to send your requests to http://localhost:3000/[prefix]/[your_path] instead. E.g. -p dev --location -l The root location of the handlers' files. Defaults to the current directory --host -o Host name to listen on. Default: localhost --port -P Port to listen on. Default: 3000 --stage -s The stage used to populate your templates. Default: the first stage found in your project. --region -r The region used to populate your templates. Default: the first region for the first stage found. --noTimeout -t Disables the timeout feature. --noEnvironment Turns off loading of your environment variables from serverless.yml. Allows the usage of tools such as PM2 or docker-compose. --resourceRoutes Turns on loading of your HTTP proxy settings from serverless.yml. --dontPrintOutput Turns off logging of your lambda outputs in the terminal. --httpsProtocol -H To enable HTTPS, specify directory (relative to your cwd, typically your project dir) for both cert.pem and key.pem files. --skipCacheInvalidation -c Tells the plugin to skip require cache invalidation. A script reloading tool like Nodemon might then be needed. --useSeparateProcesses Run handlers in separate Node processes --corsAllowOrigin Used as default Access-Control-Allow-Origin header value for responses. Delimit multiple values with commas. Default: '*' --corsAllowHeaders Used as default Access-Control-Allow-Headers header value for responses. Delimit multiple values with commas. Default: 'accept,content-type,x-api-key' --corsExposedHeaders Used as additional Access-Control-Exposed-Headers header value for responses. Delimit multiple values with commas. Default: 'WWW-Authenticate,Server-Authorization' --corsDisallowCredentials When provided, the default Access-Control-Allow-Credentials header value will be passed as 'false'. Default: true --exec "