-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
65 lines (61 loc) · 2.28 KB
/
index.html
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Service Monitor</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 50px;
}
.status {
font-size: 24px;
padding: 10px;
border-radius: 5px;
}
.online {
color: green;
background-color: #d4edda;
}
.offline {
color: red;
background-color: #f8d7da;
}
</style>
</head>
<body>
<h1>Service Monitor</h1>
<div id="status" class="status offline">Checking service status...</div>
<script>
const url = 'https://9b37cec6-557e-4abe-8f7e-10ac1becbd26-00-1q1l6sh4r3fzq.worf.repl.co:3000';
// Function to check if the URL is online
async function checkServiceStatus() {
try {
const response = await fetch(url, { method: 'GET' });
// Check if the response status is OK (status code 200)
if (response.status === 200) {
document.getElementById('status').textContent = 'Service is Online';
document.getElementById('status').classList.remove('offline');
document.getElementById('status').classList.add('online');
} else {
// If the status is not 200, it's not online
document.getElementById('status').textContent = 'Service is Not Online';
document.getElementById('status').classList.remove('online');
document.getElementById('status').classList.add('offline');
}
} catch (error) {
// If there's an error (like network issues), consider the service offline
document.getElementById('status').textContent = 'Service is Not Online';
document.getElementById('status').classList.remove('online');
document.getElementById('status').classList.add('offline');
}
}
// Run the check when the page loads
window.onload = function() {
checkServiceStatus();
};
</script>
</body>
</html>