20 lines
369 B
Go
20 lines
369 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
func handler(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, "Hello World!")
|
|
}
|
|
|
|
func main() {
|
|
// Register the handler function to handle requests to "/"
|
|
http.HandleFunc("/", handler)
|
|
|
|
// Start the HTTP server on port 3000
|
|
fmt.Println("Example app listening on port 3000!")
|
|
http.ListenAndServe(":3000", nil)
|
|
}
|