serverless-plugin-static
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

serverless-plugin-static

NPM Version Build Status Test Coverage

A serverless framework plugin to serve static files locally

Contents

  1. Usage requirements
  2. Installation
  3. Quick start

Usage requirements

Requires Node 10.

It's recommended to use this plugin along with serverless-offline.

Installation

Obviously, you should have Serverless-framework installed. If it's not, please start from this guide.

Then install the package:

npm install serverless-plugin-static -D

You can start serving the static folder by the CLI command, but probably for local development you should use serverless-offline plugin:

npm install serverless-offline -D

Quick start

Add the plugins to your serverless.yml:

plugins:
  - serverless-plugin-static
  - serverless-offline

Configure the plugin by providing folder path and server port, default values are:

custom:
  static:
    folder: ./static
    port: 8080

Start the application:

serverless offline start

You can also start serving files separately by the command:

serverless serve --folder ./static --port 8080

Or with the shortcuts:

serverless serve -f ./static -p 8080

Note: do not use CLI options with serverless-offline start command or any other plugins that create a server, since port argument will cause conflicts.

Package Sidebar

Install

npm i serverless-plugin-static

Weekly Downloads

205

Version

0.0.7

License

MIT

Unpacked Size

10.7 kB

Total Files

9

Last publish

Collaborators

  • a-pavlenko