Server-Side Scripting/Introduction/Go

app.go

edit
// Displays "Hello world!"
//
// References:
//  https://repl.it/@mauriycf/A-simple-web-server-in-go#main.go
//  https://gowebexamples.com/hello-world/

package main

import (
    "net/http"
    "io"
)

func handler(response http.ResponseWriter, request *http.Request) {
    io.WriteString(response, "Hello world!")
}

func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":8000", nil)
}

Try It

edit

Copy and paste the code above into the following free online development environment or use your own Go compiler / interpreter / IDE.

See Also

edit