Share your local Rails Application via ngrok Link.

Share your local Rails Application via ngrok Link.

10 Dec 2021
0 Comments
Share your local Rails Application via ngrok Link.

Prerequisites:

  • You should have a ngrok account and ngrok should be on your system.

  • For assistance with installing ngrok and setting your ngrok account,
    please visit: https://dashboard.ngrok.com/get-started/setup

 

Let's get started with the setting up ngrok in your rails application
 

1. Start the ngrok server on your desired port number with this command.

command: ./ngrok HTTP 3000

Note: you should run this command in the terminal where you have unzipped the ngrok installation file.

rails-application

command-output

If your terminal looks like something above the image, you have started ngrok server on your given port no.

 

2. Copy the "240f-59-95-101-113.ngrok.io" from the ngrok server you've started(have a look at the white rectangle above).


3. Goto application.rb file of the rails application you want to use ngrok for.

 

4. Add the following line in your application.rb file.

THE LINE: config.hosts << "2a1e-59-95-101-113.ngrok.io"

Note: You will have something different number on "2a1e-59-95-101-113.ngrok.io" mine.

application.rb

5. Start your application on your local server.

command: rails s

Start-rails-server

 

6. Now search in the browser with the link.

ngrok-link




Leave a comment: