Wednesday 20 August 2014

embed command prompt or terminal in website using node.js

Standard
today i will explain most interesting topic on node.js.
it is not important that you know all about computer language but if you know or feel nothing is impossible then you can do anything today i will tell you like that type of job .
this job actually how you implement or embed your server command prompt or operating system terminal in website.
if you full article then you can realize that it's so easy.
OK now start your job, first open your terminal and go to your application folder and type bellow command:

sudo npm install tty.js



after few minute you will see tty.js installed  then create a file like shell.js beside of node_module folder and and open in editor and copy bellow command in this file:

 var tty = require('tty.js');

var app = tty.createServer({
  shell: 'bash',
  users: {
    foo: 'bar'
  },
  port: 8000
});

app.listen();

after copy type bellow command in terminal:

node shell

next open your browser and type http://localhost:8000 in address bar and press enter then open a window where give your system name and password and next open a webpage and you can see two button in right side
 and click on open terminal button and then open a terminal




ok now you have created a web console if want to change html then goto node_module folder and next tty.js folder next static folder and where you will see a index.html file and open it in your editor and change anything what you want

ok now you have know how you implement/embed a command prompt in website.

if i got more time then i will give you more better and flexible command prompt

enjoy