23 lines
376 B
Go
23 lines
376 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"os"
|
|
)
|
|
|
|
const version = "1.0.0"
|
|
|
|
func main() {
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, "Hello, World! (Version %s)\n", version)
|
|
})
|
|
|
|
port := os.Getenv("PORT")
|
|
if port == "" {
|
|
port = "8080"
|
|
}
|
|
|
|
fmt.Printf("Server starting on port %s...\n", port)
|
|
http.ListenAndServe(":"+port, nil)
|
|
} |