Skip to content

Commit 14fcfb4

Browse files
committed
feat: test and update Heartbeat check ping examples
1 parent 766e18c commit 14fcfb4

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

site/content/docs/heartbeat-checks/_index.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,11 @@ run_backup.sh && curl -m 5 --retry 3 https://ping.checklyhq.com/f0e0b1d3-665d-49
139139
### Kubernetes CronJob
140140
Here is an example of how to add the curl command to a Kubernetes CronJob.
141141

142-
```BASH
142+
```YAML {title="my-scheduled-job.yaml"}
143143
apiVersion: batch/v1
144144
kind: CronJob
145145
metadata:
146146
name: nightly
147-
namespace: example
148147
spec:
149148
schedule: "0 2 * * *"
150149
jobTemplate:
@@ -170,7 +169,7 @@ This is an example with the built-in [https.get](https://nodejs.org/api/https.ht
170169
{{< tabs "https.get" >}}
171170
{{< tab "Typescript" >}}
172171
```ts {title="my-scheduled-job.ts"}
173-
const https = require("https");
172+
import https from "https";
174173

175174
// Sample URL
176175
const url = "https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4";
@@ -186,7 +185,6 @@ https.get(url, options, (res) => {
186185
console.log("responseBody:", data);
187186
});
188187
});
189-
190188
```
191189
{{< /tab >}}
192190
{{< tab "Javascript" >}}
@@ -207,7 +205,6 @@ https.get(url, options, (res) => {
207205
console.log("responseBody:", data);
208206
});
209207
});
210-
211208
```
212209
{{< /tab >}}
213210
{{< /tabs >}}
@@ -219,19 +216,21 @@ You can also use [axios](https://axios-http.com/):
219216
```ts {title="my-scheduled-job.ts"}
220217
import axios from 'axios'
221218

222-
axios.get('https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4').then(resp => {
223-
console.log(resp.data);
224-
})
219+
axios.get('https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4')
220+
.then(resp => {
221+
console.log(resp.data);
222+
})
225223

226224
```
227225
{{< /tab >}}
228226
{{< tab "JavaScript" >}}
229227
```js {title="my-scheduled-job.js"}
230228
const axios = require('axios');
231229

232-
axios.get('https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4').then(resp => {
233-
console.log(resp.data);
234-
})
230+
axios.get('https://ping.checklyhq.com/87c05896-3b7d-49ae-83ff-5e81323a54c4')
231+
.then(resp => {
232+
console.log(resp.data);
233+
})
235234
```
236235
{{< /tab >}}
237236
{{< /tabs >}}

0 commit comments

Comments
 (0)