- Usar el método
HandleFuncdehttp - Se pasan 2 parámetros
- El primero es la
URI, el segundo es una función anónima - Dentro de la función anónima se pasas 2 parámetros
w *http.ResponseWriter, r *http.Request - con
wle respondemos al cliente en el navegador
Created
April 5, 2020 00:33
-
-
Save juliocabrera820/e21fdfdc49bc8a661414486bc9210065 to your computer and use it in GitHub Desktop.
Método HandleFunc
This file contains hidden or 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 ( | |
| "net/http" | |
| "log" | |
| "fmt" | |
| ) | |
| func main() { | |
| http.HandleFunc("/", func (w http.ResponseWriter,r *http.Request){ | |
| fmt.Fprintf(w,"Hola") | |
| }) | |
| log.Fatal(http.ListenAndServe(":3000",nil)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment