Merge pull request #31 from influxdata/js-transpiler-ping

feat(http): add a /ping endpoint to the transpiler
pull/10616/head
Jonathan A. Sternberg 2018-06-19 15:47:04 -05:00 committed by GitHub
commit 6aa578c7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -28,10 +28,18 @@ func NewTranspilerQueryHandler(orgID platform.ID) *TranspilerQueryHandler {
Logger: zap.NewNop(),
}
h.HandlerFunc("GET", "/ping", h.servePing)
h.HandlerFunc("POST", "/query", h.handlePostQuery)
return h
}
// servePing returns a simple response to let the client know the server is running.
// This handler is only available for 1.x compatibility and is not part of the 2.0 platform.
func (h *TranspilerQueryHandler) servePing(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusNoContent)
}
// handlePostInfluxQL handles query requests mirroring the 1.x influxdb API.
func (h *TranspilerQueryHandler) handlePostQuery(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()