mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-09 00:41:07 +08:00
Push Examples (#3735)
This commit is contained in:
19
extra/push-examples/typescript-fetch/README.md
Normal file
19
extra/push-examples/typescript-fetch/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
Node.js (ts-node)
|
||||
|
||||
```bash
|
||||
ts-node index.ts
|
||||
```
|
||||
|
||||
Deno
|
||||
|
||||
```bash
|
||||
deno run --allow-net index.ts
|
||||
```
|
||||
|
||||
Bun.js
|
||||
|
||||
```bash
|
||||
bun index.ts
|
||||
```
|
||||
|
10
extra/push-examples/typescript-fetch/index.ts
Normal file
10
extra/push-examples/typescript-fetch/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
const pushURL : string = "https://example.com/api/push/key?status=up&msg=OK&ping=";
|
||||
const interval : number = 60;
|
||||
|
||||
const push = async () => {
|
||||
await fetch(pushURL);
|
||||
console.log("Pushed!");
|
||||
};
|
||||
|
||||
push();
|
||||
setInterval(push, interval * 1000);
|
13
extra/push-examples/typescript-fetch/package.json
Normal file
13
extra/push-examples/typescript-fetch/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"scripts": {
|
||||
"ts-node": "ts-node index.ts",
|
||||
"deno": "deno run --allow-net index.ts",
|
||||
"bun": "bun index.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.6.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user