package main import ( "net/http" "os" "gitserver.in/patialtech/mux" "gitserver.in/patialtech/rano/graph" "gitserver.in/patialtech/rano/pkg/logger" ) func main() { r := mux.NewRouter() // graphiql r.Get("/graphiql", graph.GraphiQL("/query")) // graph query r.Post("/query", graph.Query) // catch all r.Get("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("hello there")) }) port := os.Getenv("GRAPH_PORT") if port == "" { port = "4001" } r.Serve(func(srv *http.Server) error { srv.Addr = ":" + port logger.Info("graph server listening on %s", srv.Addr) return srv.ListenAndServe() }) }