@jajoosam/

kron-test

Express

No description

fork
loading
Files
  • index.js
  • package-lock.json
  • package.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Change this 👇
var link = `https://kron-test.jajoosam.repl.co/ping`;
var interval = 5; //seconds

const express = require('express');
const app = express();
const axios = require('axios');

app.use(express.static('public'));

app.get('/', (req, res) => {
	res.send('Hello Express app');
});

app.get('/ping', (req, res) => {
  var num = parseInt(req.query.num);
	console.log(`Ping #${num}`);
  num++;
	//axios.get(`https://kron.fun/?time=${interval}&url=${encodeURIComponent(link+ '?num=' + num)}`)
	res.send('OK');
});

console.log(`Go to https://kron.fun/?time=${interval}&url=${encodeURIComponent(link) + '?num=1'} to start this off.`)

app.listen(3000, () => console.log('server started'));