when (NimMajor, NimMinor) < (1, 4): {.push raises: [Defect].} else: {.push raises: [].} import chronicles, json_serialization, json_serialization/std/options, presto/[route, client] import ../serdes, ../responses logScope: topics = "waku node rest health_api" proc decodeBytes*(t: typedesc[string], value: openArray[byte], contentType: Opt[ContentTypeData]): RestResult[string] = if MediaType.init($contentType) != MIMETYPE_TEXT: error "Unsupported contentType value", contentType = contentType return err("Unsupported contentType") var res: string if len(value) > 0: res = newString(len(value)) copyMem(addr res[0], unsafeAddr value[0], len(value)) return ok(res) proc healthCheck*(): RestResponse[string] {.rest, endpoint: "/health", meth: HttpMethod.MethodGet.}