Skip to content

Commit bfef685

Browse files
author
Coderian
authored
Update server.go
1 parent 2f93f22 commit bfef685

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

server.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ import (
55
"net/http"
66
"path/filepath"
77
"strings"
8+
9+
"github.com/fatih/color"
810
)
911

1012
type Server struct {
11-
router *Router
12-
notFound HandlerFunc
13+
router *Router
14+
notFound HandlerFunc
1315
}
1416

17+
// A new Flint Server is created.
1518
func NewServer() *Server {
1619
s := &Server{
1720
router: NewRouter(),
1821
}
19-
// Varsayılan 404
2022
s.notFound = func(ctx *Context) {
2123
ctx.Default404()
2224
}
@@ -50,7 +52,9 @@ func (s *Server) Run(addr ...string) error {
5052
port = addr[0]
5153
}
5254

53-
fmt.Println("Flint-Server starting...")
55+
boldWhite := color.New(color.FgWhite, color.Bold)
56+
boldWhite.Println("Flint Server is Starting...")
57+
fmt.Println("---------------------------")
5458

5559
displayAddr := port
5660
if strings.HasPrefix(port, ":") {
@@ -61,7 +65,8 @@ func (s *Server) Run(addr ...string) error {
6165
displayAddr = "http://" + port
6266
}
6367

64-
fmt.Println("Listening on", displayAddr)
68+
color.Red("Listening on %s", displayAddr)
69+
color.Cyan("Port: %s", strings.TrimPrefix(port, ":"))
6570

6671
err := http.ListenAndServe(port, s.router)
6772
if err != nil {

0 commit comments

Comments
 (0)