- #Use ngrok to show local web server mac mac os x#
- #Use ngrok to show local web server mac code#
- #Use ngrok to show local web server mac download#
Route the endpoint that our slash command will point to and send back a simple response to indicate that ngrok is workingĪpp.The ngrok client will automatically assign you a URL like :1234. We create a function which handles any requests and sends a simple response function handleRequest( request, response), //Query string data Logically this has to be the same port than we specified on ngrok. We define the port we want to listen to. This module contains all the logic for dealing with HTTP requests. I've commented it so you can understand what's going on with each line: // First we need to import the HTTP module. Create an index.js file inside that folder and open it up in your editor. Now create an empty folder for your project, let's name it slackapp. We'll be using Node.js to develop our app, so you'll need to make sure you've installed it on your machine as well.
#Use ngrok to show local web server mac code#
Let's set up a simple web server to processes all incoming HTTP requests.įor this part you'll need a code editor such as Sublime Text or Brackets. While we've tunneled our app to the internet through that port &mash we really don't have any app running yet! We'll need to create a web service that points to that port. Let's just click on the first HTTP url there to make a simple GET request from our browser. If we open up the Web Interface, we'll see that there are no requests since we haven't made any requests to our new ngrok address. Let's access it by following the Web Interface URL įinally, one of ngrok's neatest features is a UI to inspect requests. The address to access it from the internet would be the one next to Forwarding, with ngrok.io domain. The Online is a good sign! It means the tunnel is working and your app is now accessible at that particular 4390 port. If all goes well you should see the following: If ngrok is on your $PATH, you can simply type the following from any directory: ngrok http 4390 If you went for option A on Step 2, fire up a Terminal window, navigate to the directory where you unzipped ngrok and start it by telling it which port we want to expose to the public internet. It's time to run ngrok and let the magic happen. In most cases this is usually: /usr/ local/bin To get your system's $PATH simply type from the Terminal: echo $PATH The advantage of going with this option is that you'll be able to run ngrok from any path on the command line. Depending on how you want to run the app, you need to pay attention to where you extract the file:Ī) You can extract ngrok into the folder of your preference and run ngrok from there.ī) (Recommended) Extract ngrok on your system's $PATH directory. Installing ngrok really only consists of extracting the file.
#Use ngrok to show local web server mac mac os x#
In our case, we'll be downloading the Mac OS X 64-bit version.
#Use ngrok to show local web server mac download#
Go to and download the version that corresponds to your platform.