Node app.js 를 통한 REDIS에서 데이타 조회 (SQLite DataBase에 저장되어진 시세데이타를 불러오기, 실시간이 아님)

1. index.html에서 app.js로 데이타포맷 보내기(SQLite DataBase에 저장되어진 시세데이타를 불러오기, 실시간이 아님)
        async function sendData() {

            const data = {
                proto: "r",
                sender: "1127001637919216845106",
                id: "QUERY.0001574960.001",
                ts: new Date().toISOString(),
                method: "",
                query: "A301S",
                colcnt: ""
            };

            const response = await fetch('/send', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(data)
            });
            const result = await response.json();
        }
2. REDIS에서 app.js 를 통한 JSON데이타 하나씩 꺼내오기
3  index.html에서 반복문을 통해서 하나씩 테이블에 출력
3.1 - index.html이 주된 메인이 되어서 control하므로, 반복문을 빠져나올수 있는 이벤트가 필요함
3.2 - JSON포맷중에 남은 항목에 서버에서 호출되어진 데이타의 Total개수를 표시
index++;
console.log(`Index: ${index}, Data Result: ${data.result}`);
if (data.result == index)
{
console.log(`Index: ${index}, Data Result: ${data.result}`);
console.log(`Index: ${index}, Data Result: ${data.result}`);
break;
}

4. 정상적으로 조회가 되는것을 확인

app.js
0.00MB
index.html
0.03MB

+ Recent posts