forked from snxraven/autoinstallers
30 lines
309 B
Go
30 lines
309 B
Go
// webserver that says hello
|
|
|
|
|
|
package main
|
|
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
|
|
func main() {
|
|
http.HandleFunc("/", handler)
|
|
http.ListenAndServe(":8080", nil)
|
|
}
|
|
|
|
|
|
func handler(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, "Hello, world!")
|
|
}
|
|
|
|
|
|
// Output:
|
|
// $ go run test.go
|
|
// Hello, world!
|
|
// $
|
|
|
|
|