Serverless plugin that creates ngrok public tunnel on localhost. Optionally, writes tunnels url to .env file and deletes them after session is over. Useful for when you want to expose url for other applications to use (for example mobile application).
Add serverless-ngrok-tunnel to your project:
npm install --save-dev serverless-ngrok-tunnel
Then inside your serverless.yml
file add following entry to the plugins section:
plugins:
- serverless-ngrok-tunnel
First you will need to configure tunnels. In your serverless.yml
file add:
custom:
ngrokTunnel:
envPath: '../.env' # optional. Path to your .env file, relative to serverless.yml file
tunnels: # required
# if you are using `serverless-offline` plugin, expose api gateway
- port: 8000 # required
envProp: 'API_GATEWAY' # optional. property in .env file to assign url value to
# or if you are using `serverless-iot-offline` plugin, expose IoT endpoint
- port: 1884
envProp: 'IOT_ENDPOINT'
ws: true # expose web-socket url
path: '/mqqt' # additional path to url
- port: 9000
ngrokOptions: # optional. custom ngrok options
authtoken: '12345'
region: 'us'
subdomain: 'my-subdomain'
For a list of available ngrok options checkout ngrok documentation.
To start tunnel/s run sls tunnel
.
If you are using serverless-offline
plugin
- v2: start offline with option flag:
sls offline start --tunnel=true
. - v3: start offline with option flag:
sls offline start --param="tunnel=true"
.
Yes, please. Checkout contributing guidelines.
MIT