Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ func TestePrint() string {
}

func main() {
httputils.ServeHTTPS()
httputils.ServeHTTP()
httputils.Serve()
}
15 changes: 13 additions & 2 deletions httputils/httputil.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@ package httputils

import (
"crypto/tls"
"flag"
"fmt"
"log"
"net/http"

"github.com/gorilla/mux"
)

// Serve inicializa o servidor
func Serve() {
tls := flag.Bool("tls", false, "use for secure server")
flag.Parse()
if *tls {
serveHTTPS()
}
serveHTTP()
}

// ServeHTTPS inicializa escuta e serve HTTP/2
func ServeHTTPS() {
func serveHTTPS() {

r := mux.NewRouter()
r.HandleFunc("/", rootHTTPHandler)
Expand All @@ -34,7 +45,7 @@ func ServeHTTPS() {
}

// ServeHTTP inicializa escuta e serve HTTP/2
func ServeHTTP() {
func serveHTTP() {

r := mux.NewRouter()
r.HandleFunc("/", rootHTTPHandler)
Expand Down