[GO] I tried using ngrok

Overview

This is the third post for a new graduate. I had the opportunity to use ngrok and found it very convenient, so I will write how to use it. ngrok is a tool that allows you to access the server launched on localhost from the outside. This time I launched localhost with Go and tried to access localhost from my personal smartphone.

install ngrok

After registering as a user from the Official Site, download the zip file and unzip it. You can use github or google account for user registration. After unzipping, start ngrok.exe and type in the command.

ngrok http 8080

If you see the following display, you are done. You can access localhost: 8080 from the external environment with https://66336728576f.ngrok.io.

ngrok by @inconshreveable
(Ctrl+C to quit)
Session Status                online
Version                       2.3.35
Account Account name(Plan: Free)
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://66336728576f.ngrok.io -> http://localhost:8080
Forwarding                    https://66336728576f.ngrok.io -> http://localhost:8080
Connections                   ttl     opn     rt1     rt5     p50     p90
0       0       0.00    0.00    0.00    0.00

Actually access from the outside

package main

import (
	"fmt"
	"net/http"
)

func main() {
	http.HandleFunc("/", handler)
	http.ListenAndServe(":8080", nil)
}
func handler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "ngrok super convenient")
}

When I accessed https://66336728576f.ngrok.io from my personal smartphone, ngrok super convenient was displayed! ngrok It's convenient.

Recommended Posts

I tried using ngrok
I tried using parameterized
I tried using argparse
I tried using mimesis
I tried using anytree
I tried using aiomysql
I tried using Summpy
I tried using coturn
I tried using Pipenv
I tried using matplotlib
I tried using "Anvil".
I tried using Hubot
I tried using ESPCN
I tried using openpyxl
I tried using Ipython
I tried using PyCaret
I tried using cron
I tried using face_recognition
I tried using Jupyter
I tried using PyCaret
I tried using Heapq
I tried using doctest
I tried using folium
I tried using jinja2
I tried using folium
I tried using time-window
[I tried using Pythonista 3] Introduction
I tried using easydict (memo).
I tried face recognition using Face ++
I tried using BigQuery ML
I tried using Amazon Glacier
I tried using git inspector
[Python] I tried using OpenPose
I tried using magenta / TensorFlow
I tried using AWS Chalice
I tried using Slack emojinator
I tried using Rotrics Dex Arm # 2
I tried using Thonny (Python / IDE)
I tried server-client communication using tmux
I tried reinforcement learning using PyBrain
I tried deep learning using Theano
Somehow I tried using jupyter notebook
[Kaggle] I tried undersampling using imbalanced-learn
I tried shooting Kamehameha using OpenPose
I tried using the checkio API
[Python] I tried using YOLO v3
I tried asynchronous processing using asyncio
I tried scraping
I tried PyQ
I tried AutoKeras
I tried django-slack
I tried Django
I tried spleeter
I tried cgo
I tried using Amazon SQS with django-celery
I tried using Azure Speech to Text.
I tried using Twitter api and Line api
I tried playing a ○ ✕ game using TensorFlow
I tried using Selenium with Headless chrome
I tried drawing a line using turtle
[Kaggle] I tried ensemble learning using LightGBM