// Copyright 2020 The Go Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
package main | |
import ( | |
"log" | |
"net/http" | |
"os" | |
) | |
func main() { | |
http.Handle("/", fileServerHandler(relativeFile("./static"), http.HandlerFunc(homeHandler))) | |
port := os.Getenv("PORT") | |
if port == "" { | |
port = "8080" | |
} | |
log.Printf("Listening on :" + port) | |
log.Fatal(http.ListenAndServe(":"+port, http.DefaultServeMux)) | |
} |