serverless-offline-plus-static

1.0.4 • Public • Published

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

2. 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

3. 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 SLS_DEBUG=*

SLS_DEBUG=* serverless local-http-server

License & Credits

Licensed under the MIT license.

Forked from serverless-local-dev-server by DieProduktMacher.

Package Sidebar

Install

npm i serverless-offline-plus-static

Weekly Downloads

15

Version

1.0.4

License

MIT

Last publish

Collaborators

  • shakiro214