Merge pull request #31 from influxdata/js-transpiler-ping
feat(http): add a /ping endpoint to the transpilerpull/10616/head
commit
6aa578c7f7
|
@ -28,10 +28,18 @@ func NewTranspilerQueryHandler(orgID platform.ID) *TranspilerQueryHandler {
|
||||||
Logger: zap.NewNop(),
|
Logger: zap.NewNop(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h.HandlerFunc("GET", "/ping", h.servePing)
|
||||||
h.HandlerFunc("POST", "/query", h.handlePostQuery)
|
h.HandlerFunc("POST", "/query", h.handlePostQuery)
|
||||||
return h
|
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.
|
// handlePostInfluxQL handles query requests mirroring the 1.x influxdb API.
|
||||||
func (h *TranspilerQueryHandler) handlePostQuery(w http.ResponseWriter, r *http.Request) {
|
func (h *TranspilerQueryHandler) handlePostQuery(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
|
|
Loading…
Reference in New Issue