Get your own Node server
const readline = require('readline');

// Create interface for reading from stdin and writing to stdout
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

// Ask a question and get the user's input
rl.question('What is your name? ', (name) => {
  console.log(`Hello, ${name}!`);

  // Ask another question
  rl.question('How are you today? ', (response) => {
    console.log(`Glad to hear: ${response}`);
    
    // Close the interface
    rl.close();
  });
});

// Handle the close event
rl.on('close', () => {
  console.log('Interface closed. Goodbye!');
});

              
What is your name? John
Hello, John!
How are you today? I'm doing great
Glad to hear: I'm doing great
Interface closed. Goodbye!