react-public-url
v1.0.2
Published
A CLI tool to create a public URL using ngrok
Downloads
7
Readme
React Public URL - CLI Tool
This is a command-line interface (CLI) tool that simplifies the process of creating a public URL for your locally hosted applications using ngrok. It also generates a QR code for easy access to your public URL, making it convenient for testing your application across devices.
Features
- Generate a public URL using ngrok for any local web server.
- Automatically generate and display a QR code in the terminal.
- Simple, interactive command-line interface to select the port of your application.
- Secure tunneling using ngrok authtoken for trusted connections.
Requirements
- Node.js version 14 or higher.
- ngrok account (for obtaining the authentication token).
Installation
To install this CLI tool, you can use npm:
npm install -g react-public-url
Setup
After installing the package, create a
.env
file in your project root and add the following environment variables:PORT=3000 # Port where your local app is running NGROK_AUTHTOKEN=your_ngrok_auth_token # Your ngrok authentication token
If you don't have an ngrok auth token, you can sign up for one at ngrok.
Usage
Start your local application on any port, for example:
npm start
Once your app is running, you can run the
react-public-url
CLI command to create a public URL and display the QR code in your terminal:react-public-url
The CLI will prompt you to enter the port your application is running on if it is not defined in the
.env
file:Which port is your application running on? (e.g., 3000):
After that, the tool will generate a public URL using ngrok and print it in the terminal:
Your public link is: https://your-ngrok-url.ngrok.io
Additionally, a QR code will be generated directly in the terminal, allowing you to scan it with a mobile device to access the application instantly.
Example
react-public-url
Output:
Your public link is: https://your-ngrok-url.ngrok.io
Here is the QR Code for your public site:
License
This project is licensed under the MIT License. See the LICENSE file for more information.
Author: Leonardo Valões Novaes Ribeiro
Version: 1.0.1
Keywords: ngrok, qr-code, cli