MCPcopy
hub / github.com/gin-gonic/gin / Run

Method Run

gin.go:540–556  ·  view source on GitHub ↗

Run attaches the router to a http.Server and starts listening and serving HTTP requests. It is a shortcut for http.ListenAndServe(addr, router) Note: this method will block the calling goroutine indefinitely unless an error happens.

(addr ...string)

Source from the content-addressed store, hash-verified

538// It is a shortcut for http.ListenAndServe(addr, router)
539// Note: this method will block the calling goroutine indefinitely unless an error happens.
540func (engine *Engine) Run(addr ...string) (err error) {
541 defer func() { debugPrintError(err) }()
542
543 if engine.isUnsafeTrustedProxies() {
544 debugPrint("[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\n" +
545 "Please check https://github.com/gin-gonic/gin/blob/master/docs/doc.md#dont-trust-all-proxies for details.")
546 }
547 engine.updateRouteTrees()
548 address := resolveAddress(addr)
549 debugPrint("Listening and serving HTTP on %s\n", address)
550 server := &http.Server{ // #nosec G112
551 Addr: address,
552 Handler: engine.Handler(),
553 }
554 err = server.ListenAndServe()
555 return
556}
557
558// RunTLS attaches the router to a http.Server and starts listening and serving HTTPS (secure) requests.
559// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)

Calls 6

updateRouteTreesMethod · 0.95
HandlerMethod · 0.95
debugPrintErrorFunction · 0.85
debugPrintFunction · 0.85
resolveAddressFunction · 0.85