demo-node / index.js
randydev's picture
Update index.js
75396ac verified
raw
history blame contribute delete
657 Bytes
import express from 'express';
import { randomBytes } from "crypto";
import cron from 'node-cron';
const app = express();
const port = 7860
app.post('/webhook', (req, res) => {
console.log('Received webhook:', req.body);
res.status(200).send('Webhook received');
});
cron.schedule('*/2 * * * *', () => {
fetch('https://docs-api.dev.ryzenths.dpdns.org/runtime')
.then(response => {
console.log('Pinged service:', response.status);
})
.catch(error => {
console.error('Error pinging service:', error.message);
});
});
app.listen(port, "0.0.0.0", () => {
console.log(`Server running on http://localhost:${port}`);
});