Skip to content

Instantly share code, notes, and snippets.

@pedrolopesme
Last active March 11, 2018 05:16
Show Gist options
  • Save pedrolopesme/24e99b498249845b4b319fd367826982 to your computer and use it in GitHub Desktop.
Save pedrolopesme/24e99b498249845b4b319fd367826982 to your computer and use it in GitHub Desktop.
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