svrx-plugin-localtunnel
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -38,13 +38,18 @@ const localtunnel = require('localtunnel'); | ||
stopSpin(); | ||
if (err) | ||
if (err) { | ||
logger.error( | ||
`localtunnel setup failed, beacuse {err.stack || err.message}` | ||
); | ||
events.emit('localtunnel:error', err.message); | ||
} | ||
logger.notify( | ||
`url is available at ${chalk.underline.blue(tunnel.url)}` | ||
); | ||
events.emit('localtunnel:ready', tunnel); | ||
} | ||
); | ||
tunnel.on('error', err => { | ||
stopSpin(); | ||
logger.error(err.message); | ||
events.emit('localtunnel:error', err.message); | ||
}); | ||
@@ -51,0 +56,0 @@ }); |
{ | ||
"name": "svrx-plugin-localtunnel", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "localtunnel plugin for server-x", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# svrx-plugin-localtunnel | ||
[localtunnel client](https://github.com/localtunnel/localtunnel) plugin for [svrx](https://github.com/x-orpheus/svrx) | ||
[svrx](https://github.com/x-orpheus/svrx) plugin for [localtunnel](https://github.com/localtunnel/localtunnel) | ||
@@ -11,15 +11,15 @@ This plugin is used to expose your local server to `localtunnel.me` | ||
### cli | ||
### Via CLI | ||
```bash | ||
svrx -p localtunnel?subdomain=svrx | ||
svrx -p "localtunnel" | ||
``` | ||
### manual | ||
### Via API | ||
```js | ||
const svrx = require('svrx'); | ||
const svrx = require('@svrx/svrx'); | ||
svrx({ | ||
plugins: ['localtunnel'] | ||
svrx({ | ||
plugins: ['localtunnel'] | ||
}).start(); | ||
@@ -29,3 +29,3 @@ | ||
**with options** | ||
**With options** | ||
@@ -44,4 +44,16 @@ ```js | ||
> example above will init https://svrx.localtunnel.me for you | ||
**With events** | ||
```js | ||
const server = svrx({ | ||
plugins: ['localtunnel'] | ||
}); | ||
server.on('localtunnel:ready', (tunnel) => { | ||
console.log(`url is available at ${tunnel.url}`) | ||
}); | ||
server.start(); | ||
``` | ||
> Example above will prepare https://svrx.localtunnel.me for you | ||
## Options | ||
@@ -53,3 +65,3 @@ | ||
subdomain is **optional**, localtunnel will auto create a random domain for you. | ||
Subdomain is **optional**, localtunnel will auto create a random domain for you. | ||
@@ -64,7 +76,25 @@ ### **localhost \[String]:** | ||
specify host if you want to use custom [localtunnel/server](https://github.com/localtunnel/server) | ||
specify host if you want to use custom [localtunnel/server](https://github.com/localtunnel/server) , or [Deploy localtunnel server with docker-compose](https://github.com/x-orpheus/localtunnel-server) | ||
deafult is `https://localtunnel.me` | ||
Deafult is `https://localtunnel.me` | ||
## Events | ||
### **localtunnel:ready** | ||
Emitted when localtunnel is ready. | ||
params: | ||
`tunnel [Object]`: localtunnel instance, see [localtunnel API](https://github.com/localtunnel/localtunnel#api) | ||
### **localtunnel:error** | ||
Emitted when an error occurred. | ||
params: | ||
`message [String]`: error message | ||
3839
60
96