NodeJS Prompt

Description

Sometimes you just need a simple terminal application that requests user input. Here's a quick way to prompt the user for input:

Javascript

// NodeJS Console I/O
const readline = require("readline");
const rl = readline.createInterface(process.stdin, process.stdout);

rl.on("line", line => {
   console.log(`You typed ${line}`);
   rl.prompt();
});

rl.setPrompt("Action> ");
rl.prompt();