const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,//Readable 스트림을 읽게 해주는 프로퍼티고 이 옵션은 필수
output: process.stdout
});
rl.question('What do you think of Node.js?', (answer) => {
// TODO: Log the answer in a database
console.log(`Thank you for your valuable feedback: ${answer}`);
rl.close();
});
rl.on('close', ()=>{
console.log('Have a great day!');
})
'What do you think of Node.js?'라는 질문이 출력되고 값을 입력하면 콜백함수의 매개변수인 answer로 값을 받을 수 있다.
이후 console.log(~~)의 값이 출력되고
close이벤트로 console.log(~~)값 출력 후 프로세스 종료.
1.라운드로빈
2.가중 라운드로빈
3.IP해시
4.최소 연결 방식
5.최소 리스폰타임
https://nodejs.org/api/readline.html#readline_event_close
https://nodejs.org/api/process.html#process_process_stdin
https://nodejs.org/api/stream.html#stream_readable_read_size
https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding
https://m.post.naver.com/viewer/postView.nhn?volumeNo=27046347&memberNo=2521903
https://nesoy.github.io/articles/2018-06/Load-Balancer