A serverless framework plugin to serve static files locally
Requires Node 10.
It's recommended to use this plugin along with serverless-offline.
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
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: ./staticport: 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.