node.js io&web交互
var readline = require('readline');
var sk = require('./hello');
var rl = readline.createInterface(process.stdin,process.stdout);
rl.setPrompt('请输入:');
rl.prompt();
rl.on('line',(line) =>{
var str = line.trim();
console.log('你输入的是:' + str);
rl.prompt();
if(str == 0){
console.log("帅哥!欢迎下次再来");
process.exit();
}
else{
//console.log('你输入的是:' + str);
sk.shangke(str);
sk.h();
rl.prompt();
}
});
//exports声明一个模块
exprots.shangke = function(stringa){
console.log('这个是上课的模块' + stringa);
}
function hello(){
console.log('this is hello');
}
exports.h =hello();