Skip to content

Commit 280c768

Browse files
committed
Add info endpoint to discover create ports
1 parent b0537e8 commit 280c768

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

info.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package main
2+
3+
import (
4+
"github.com/gin-gonic/gin"
5+
)
6+
7+
func infoHandler(c *gin.Context) {
8+
c.JSON(200, gin.H{
9+
"http": "http://localhost" + port,
10+
"https": "https://localhost" + port,
11+
"ws": "ws://localhost" + port,
12+
"wss": "wss://localhost" + portSSL,
13+
})
14+
}

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ func main() {
209209
r.POST("/socket.io/", socketHandler)
210210
r.Handle("WS", "/socket.io/", socketHandler)
211211
r.Handle("WSS", "/socket.io/", socketHandler)
212+
r.GET("/info", infoHandler)
212213
go func() {
213214
start := 49152
214215
end := 65535

0 commit comments

Comments
 (0)