22 أسطر
322 B
Go
22 أسطر
322 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
port := os.Getenv("PORT")
|
|
if port == "" {
|
|
port = "8000"
|
|
}
|
|
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintln(w, "Hello from Go!")
|
|
})
|
|
|
|
fmt.Println("Server listening on :" + port)
|
|
http.ListenAndServe(":"+port, nil)
|
|
}
|