serverless-offline-plus-static

Develop Serverless endpoints with static files locally

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
serverless-offline-plus-static
101.0.46 years ago6 years agoMinified + gzip package size for serverless-offline-plus-static in KB

Readme

Serverless Local Dev Server Plugin (Beta)
Develop Serverless endpoints with static files locally.
Supported features:
  • Environment variables
  • Basic HTTP integration
  • Auto reload via nodemon (see How To)

This package requires node >= 6.0
How To

  1. Install the plugin

npm install serverless-offline-plus-static --save-dev

  1. Add the plugin to your serverless configuration file

serverless.yml configuration example:
provider:
  name: aws
  runtime: nodejs6.10

functions:
  hello:
    handler: handler.hello
    events:
      - http: GET /hello

# Add serverless-offline-plus-static to your plugins:
plugins:
  - serverless-offline-plus-static

# if needed add folder for serving static files if necessary (relative to service path)
custom:
  localDevStaticFolder: path/to/static/files

  1. Start the server

serverless offline-plus-static

On default the server listens on port 3000. You can specify another one with the --port argument:
serverless offline-plus-static --port 5005

To automatically restart the server when files change, you may use nodemon:
nodemon --exec "serverless offline-plus-static" -e "js yml json"

To see responses returned from Lambda and stack traces, prepend SLSDEBUG=
SLS_DEBUG=* serverless local-http-server
License & Credits
Licensed under the MIT license.
Forked from serverless-local-dev-server by DieProduktMacher
.