Update index.js
Browse files
index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import express from 'express';
|
2 |
import { randomBytes } from "crypto";
|
|
|
3 |
const app = express();
|
4 |
|
5 |
const port = 7860
|
@@ -9,7 +10,16 @@ app.post('/webhook', (req, res) => {
|
|
9 |
res.status(200).send('Webhook received');
|
10 |
});
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
app.listen(port, "0.0.0.0", () => {
|
13 |
console.log(`Server running on http://localhost:${port}`);
|
14 |
-
console.log(randomBytes(32).toString('hex'))
|
15 |
});
|
|
|
1 |
import express from 'express';
|
2 |
import { randomBytes } from "crypto";
|
3 |
+
import cron from 'node-cron';
|
4 |
const app = express();
|
5 |
|
6 |
const port = 7860
|
|
|
10 |
res.status(200).send('Webhook received');
|
11 |
});
|
12 |
|
13 |
+
cron.schedule('*/2 * * * *', () => {
|
14 |
+
fetch('https://docs-api.dev.ryzenths.dpdns.org/runtime')
|
15 |
+
.then(response => {
|
16 |
+
console.log('Pinged service:', response.status);
|
17 |
+
})
|
18 |
+
.catch(error => {
|
19 |
+
console.error('Error pinging service:', error.message);
|
20 |
+
});
|
21 |
+
});
|
22 |
+
|
23 |
app.listen(port, "0.0.0.0", () => {
|
24 |
console.log(`Server running on http://localhost:${port}`);
|
|
|
25 |
});
|