我正在尝试在 GAE 上部署我的第一个 golang 应用程序。由于某些原因,产品处理程序无法解决,我收到 404 错误。我错过了什么吗?
package test
import "github.com/gorilla/mux"
import (
"fmt"
"net/http"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/products", ProductsHandler)
http.Handle("/", r)
e := http.ListenAndServe(":8080", r)
if e != nil {
println(e.Error())
}
}
func ProductsHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, you!")
}