Created
August 9, 2017 09:44
-
-
Save mlabouardy/0050935bdc811c17eecb6bb0b06b2518 to your computer and use it in GitHub Desktop.
http server in golang
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" | |
"log" | |
"net/http" | |
"github.com/gorilla/mux" | |
) | |
func HomeEndpoint(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintln(w, "Hello from mlabouardy :)") | |
} | |
func main() { | |
r := mux.NewRouter() | |
r.HandleFunc("/", HomeEndpoint) | |
if err := http.ListenAndServe(":8080", r); err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment