-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
46 lines (34 loc) · 1.06 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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title>API Rest Node JS</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
<script type="text/javascript">
// var socket = io('http://localhost:3000');
// socket.on('users', function (data) {
// console.log(data);
// });
// socket.on('statusUser', function (data) {
// console.log(data);
// });
var url = 'http://localhost:3000/users';
var httpRequest = new XMLHttpRequest();
httpRequest.open("GET", url);
httpRequest.responseType = "json";
httpRequest.addEventListener("readystatechange", function () {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
console.log(httpRequest.response);
console.log(httpRequest.response.headDocument);
} else {
}
}
});
httpRequest.send();
</script>
</html>