Ngrok dev
This package provides a simple way to expose your local development server to the internet using ngrok
Pre-requisites
Make sure you've set your ngrok authtoken if you're planning on running more than one tunnel at once. You can do this by running ngrok config add-authtoken <YOUR_AUTHTOKEN>
or ngrok authtoken <YOUR_AUTHTOKEN>
depending on your ngrok version. See this for more details.
Usage
ngrok-dev [<port>:<optional environment variable>]
Options
--command <command> The package.json command to run to start the server (default: dev:internal)
--subdomain <subdomain> Support for custom subdomain (default: random123)
Example package.json
{
// ...
"scripts": {
"dev": "ngrok-dev 3000:NEXTJS_URL,8080 --command custom:dev",
"custom:dev": "next dev"
}
// ...
}
This will expose your local development server on port 3000 and 8080 to the internet and set the environment variable NEXTJS_URL
to the ngrok url and expose it to your command. The port 8080 won't get an environment variable