Skip to content

Commit

Permalink
use str
Browse files Browse the repository at this point in the history
  • Loading branch information
hwbrzzl committed Jan 1, 2025
1 parent 239a841 commit a91dad5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions route.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/goravel/framework/contracts/route"
"github.com/goravel/framework/support"
"github.com/goravel/framework/support/color"
"github.com/goravel/framework/support/str"
)

var globalRecoverCallback func(ctx contractshttp.Context, err any) = func(ctx contractshttp.Context, err any) {
Expand Down Expand Up @@ -109,7 +110,7 @@ func (r *Route) Recover(callback func(ctx contractshttp.Context, err any)) {

func (r *Route) Listen(l net.Listener) error {
r.outputRoutes()
color.Green().Println("[HTTP] Listening on: http://" + l.Addr().String())
color.Green().Println("[HTTP] Listening on: " + str.Of(l.Addr().String()).Start("http://").String())

r.server = &http.Server{
Addr: l.Addr().String(),
Expand All @@ -130,7 +131,7 @@ func (r *Route) ListenTLS(l net.Listener) error {

func (r *Route) ListenTLSWithCert(l net.Listener, certFile, keyFile string) error {
r.outputRoutes()
color.Green().Println("[HTTPS] Listening on: https://" + l.Addr().String())
color.Green().Println("[HTTPS] Listening on: " + str.Of(l.Addr().String()).Start("https://").String())

r.tlsServer = &http.Server{
Addr: l.Addr().String(),
Expand All @@ -157,7 +158,7 @@ func (r *Route) Run(host ...string) error {
}

r.outputRoutes()
color.Green().Println("[HTTP] Listening on: http://" + host[0])
color.Green().Println("[HTTP] Listening on: " + str.Of(host[0]).Start("http://").String())

r.server = &http.Server{
Addr: host[0],
Expand Down Expand Up @@ -198,7 +199,7 @@ func (r *Route) RunTLSWithCert(host, certFile, keyFile string) error {
}

r.outputRoutes()
color.Green().Println("[HTTPS] Listening on: https://" + host)
color.Green().Println("[HTTPS] Listening on: " + str.Of(host).Start("https://").String())

r.tlsServer = &http.Server{
Addr: host,
Expand Down

0 comments on commit a91dad5

Please sign in to comment.