Q:
Which service(tool) like "ngrok", but support subdomain?
A:
- server sample code (golang + echo)
package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
// Echo instance
e := echo.New()
// Middleware
e.Use(middleware.Logger())
e.Use(middleware.Recover())
// Routes
e.GET("/", hello)
// Start server
e.Logger.Fatal(e.Start(":1323"))
}
// Handler
func hello(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
}
- localtunnel install & run
#### install
npm install -g localtunnel
#### start. For example
#### lt -p <LOCALHOST_PORT> --subdomain <YOUR_SUBDOMAIN>
lt -p 1323 --subdomain localtest
Now you can visit http://localtest.loca.lt to access your server from internet.
Note
- Follow latest installation step of localtunnel. Script above maybe only work for now.