Hi Kyle, thanks for the reply. My task is to setup an email whitelist to my graphiql endpoint, not sure the app.yaml solution is flexible enough for doing that?
var (
addr = ":8080"
readHeaderTimeout = 1 * time.Second
writeTimeout = 10 * time.Second
idleTimeout = 90 * time.Second
maxHeaderBytes = http.DefaultMaxHeaderBytes
)
func main() {
.....
mux := http.NewServeMux()
mux.Handle("/", handler.GraphiQL{})
....
s := &http.Server{
Addr: addr,
ReadHeaderTimeout: readHeaderTimeout,
WriteTimeout: writeTimeout,
IdleTimeout: idleTimeout,
MaxHeaderBytes: maxHeaderBytes,
Handler: mux,
}
if err := s.ListenAndServe(); err != nil {
glog.Infof("server.ListenAndServe failed: %s", err.Error())
}
}
and in the package handler:
type GraphiQL struct{}
func (h GraphiQL) ServeHTTP(w http.ResponseWriter, r *http.Request) {
err := h.Auth(w, r)
if err != nil {
fmt.Println(err.Error())
return
}
.....
}