23 lines
299 B
Go
23 lines
299 B
Go
|
|
package main
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"log"
|
||
|
|
"net/http"
|
||
|
|
"os"
|
||
|
|
)
|
||
|
|
|
||
|
|
func main() {
|
||
|
|
port := os.Getenv("PORT")
|
||
|
|
if port == "" {
|
||
|
|
port = "80"
|
||
|
|
}
|
||
|
|
|
||
|
|
bind := fmt.Sprintf(":%s", port)
|
||
|
|
log.Printf("listening on %s", bind)
|
||
|
|
|
||
|
|
if err := http.ListenAndServe(bind, nil); err != nil {
|
||
|
|
log.Fatalf("listen: %s", err)
|
||
|
|
}
|
||
|
|
}
|