I am working on this google auth chat website everything has goon really smooth everything is basically done but the last thing that is to get the messages from a json database i can send messages to the json database but i cant get the array from the object here is my code:
index.js:
socket.on('load', () => {
for (let i in data) {
socket.emit('add message', data[i]);
}
});
main.js(html file):
socket.emit('load');
socket.on('add message', (text) => {
let list = document.getElementById('list');
let li = document.createElement('li');
li.textContent = text;
list.appendChild(li)
});
