Last active
March 11, 2018 05:16
-
-
Save pedrolopesme/24e99b498249845b4b319fd367826982 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
http.HandleFunc("/", handler) // Aqui declaramos o path e o Handler | |
http.ListenAndServe(":3000", nil) // Aqui ficará a porta em que nosso Web server vai responder | |
} | |
// Aqui vamos tratar nossa requisição: o writer irá permitir | |
// definir o que desejamos escrever de volta para o client que enviou a requisiçao. | |
func handler(writer http.ResponseWriter, request *http.Request) { | |
fmt.Fprintf(writer, "Hello") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment