forked from kelvin-mai/nest-ideas-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
30 lines (28 loc) · 813 Bytes
/
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<ul id="app"></ul>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
<script>
const socket = io('http://localhost:4001');
socket.on('connection', data => console.log(data));
socket.on('newIdea', data => {
console.log(data);
document.getElementById('app').innerHTML += `
<li>
<div>
<h2>${data.idea}</h2>
<p>${data.description}</p>
</div>
</li>
`;
});
</script>
</body>
</html>