From 6aa13b276cf70ad0c8824f85c2f13a25b706ee2d Mon Sep 17 00:00:00 2001 From: Gerardo Marx Date: Wed, 15 Jul 2020 00:16:08 +0000 Subject: [PATCH] cloud9 restoring --- es.org | 22 +++++++++++++++++----- examples/node-test/simple-web-server.js | 11 +++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/es.org b/es.org index 9d04d48..a9d6c63 100755 --- a/es.org +++ b/es.org @@ -207,12 +207,12 @@ debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ cat delay_on >sudo reboot #+end_src *** Node.js, Cloud9, and BoneSccript -The BeagleBoard.org Linux distribution comes complete with a set of technologies that you can use to quickly get started with developing software and hardware applications on the boards. These are called Node.js, Cloud9, and BoneScript. *Node.js* is a programming language, *Cloud9* is an online software integrated development environment (IDE) in which you can write *Node.js* code, and *BoneScript* is a library of code for Node.js that allows you to interact with Beagle board hardware[Molloy@2019]. -**** Node.js +The BeagleBoard.org Linux distribution comes complete with a set of technologies that you can use to quickly get started with developing software and hardware applications on the boards. These are called Node.js, Cloud9, and BoneScript. *Node.js* is a programming language, *Cloud9* is an online software integrated development environment (IDE) in which you can write *Node.js* code, then *BoneScript* is a library of code for *Node.js* that allows you to interact with Beagle board hardware[Molloy@2019]. +**** A Node.js basic example Node.js is a platform for building network applications that uses the same JavaScript engine as the Google Chrome web browser. JavaScript is the programming language that is often used to create interactive interfaces within web pages. -#+begin_src -debian@beaglebone:~$ cd es-jade/ +#+begin_src shell +debian@beaglebone:~$ cd examples/ debian@beaglebone:~/es-jade$ mkdir node-test debian@beaglebone:~/es-jade$ cd node-test/ debian@beaglebone:~/es-jade$ vi hello-jade.js @@ -226,14 +226,26 @@ console.log("Hello World!"); Then, run the script by using the ~node~ command: #+begin_src -debian@beaglebone:~/es-jade/node-test$ node hello-jade.js +debian@beaglebone:~/examples/node-test$ node hello-jade.js Hello Jade-HS and world #+end_src The call to the ~node~ command works because the Node.js runtime environment is preinstalled on the BeagleBoard.org Linux image. Now lets try a more complex script; a web server. +**** A simple web server +#+begin_src java +// A simple webserver running on port 5050 +var http = requiere('http') +#+end_src +**** cloud9 +Check running services: +systemctl -all list-sockets +Install cloud9: +sudo apt reinstall c9-core-installer +About running cloud9 service: +systemctl status cloud9.service ** The linux file system and commands diff --git a/examples/node-test/simple-web-server.js b/examples/node-test/simple-web-server.js index e69de29..29958c5 100644 --- a/examples/node-test/simple-web-server.js +++ b/examples/node-test/simple-web-server.js @@ -0,0 +1,11 @@ +// a simple weberver running on port 5555: +var http = require('http'); +var server = http.createServer( + function(req, res) { + res.writeHead(200, {'content-Type': 'text/plain'}); + res.end('This is the servers answer\n Bye!\n'); + }); +server.listen(5555); +console.log('Web server running on beaglebone.local:5555'); + +