Skip to content

Commit 71d2fef

Browse files
authored
Implement basic HTTP server in main.go
1 parent ac3c4df commit 71d2fef

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

main.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
)
7+
8+
func hashuriPage(w http.ResponseWriter, r *http.Request) {
9+
fmt.Fprintf(w, "Hashuri")
10+
}
11+
12+
func main() {
13+
// create a server
14+
http.HandleFunc("/", hashuriPage)
15+
fmt.Println("Servidor rodando na porta 8080")
16+
err := http.ListenAndServe(":8080", nil)
17+
if err != nil {
18+
fmt.Println("Erro:", err)
19+
}
20+
}

0 commit comments

Comments
 (0)