javascript - raw_input alternative for node.js -


i creating server application , able write commands start server, stop server, broadcast("clients","hello") in application can't figure out how in node.

i know how inside python.

while on == 1:     cmd = raw_input("user> ")     if cmd == "start server":         startserver()     elif cmd == "stop server":         stopserver()         on = 0 

i have seen npm modules require me write arguments, want make console type application.

thanks

here's snippet removed commander.js. along these lines should work.

process.stdout.write("user> "); process.stdin.setencoding('utf8'); process.stdin.once('data', function(val){     //look @ val here , execute startserver() et al accordingly }).resume(); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -