Grand Prix International eMag - 2016 Bahrain Grand Prix Edition
Node.js Grand Prix
Click here to load reader
-
Upload
commit-university -
Category
Technology
-
view
239 -
download
0
Transcript of Node.js Grand Prix
![Page 1: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/1.jpg)
Node.js Grand Prix
![Page 2: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/2.jpg)
Node.js Grand Prix
Firenze, 20/07/172 / 10
![Page 4: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/4.jpg)
https://nodejs.orgNode.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
4 / 10
![Page 5: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/5.jpg)
Last 2 years of Node.js
v. 0.12 (2015) > 8.0 LTS (2017)
+io.js, 4, 5, 6, 7, 8
ECMAScript 6 (2016)
v.8 99%v.4 57%
v.0.12 31%
ECMAScript 7 (2017)
v.8 67%
Release v. 8: Google, IBM, Intel, Microsoft, nearForm and NodeSource
callback (pyramid of doom), Promises, channels (async-await)
Microsoft & node-chakracore
IDE (debug!)
Visual Studio Code
5 / 10
![Page 6: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/6.jpg)
https://www.raspberrypi.org
IoT leader
Low Cost: 3 B 40$, Zero 5$, Zero W $11
hardware modules: GPIO (General Purpouse IO)
software support: Debian, Android
Python, Go, Node.js, C, C++
6 / 10
![Page 7: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/7.jpg)
https://socket.io
WebSocket & HTTP fallback Real Time (soft)event based communication
server
7 / 10
socket.on('message', function (content) { console.log('socket', 'message', content)
})
client
socket.emit('message', 'ack')
![Page 8: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/8.jpg)
http://johnny-five.io
JavaScript Robotics & IoT Platform
Board support, API hardware components
const five = require('johnny-five')const Raspi = require('raspi-io')
const board = new five.Board({ io: new Raspi() })const pin = new five.Pin('GPIO9')
pin.write(0) pin.write(1)
8 / 10
![Page 9: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/9.jpg)
backend
9 / 10
![Page 10: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/10.jpg)
frontend
10 /10
![Page 11: Node.js Grand Prix](https://reader038.fdocuments.us/reader038/viewer/2022100803/5a6e382c7f8b9ad4678b54ef/html5/thumbnails/11.jpg)
10 / 10
Ready? Go!
ssh [email protected] password: braceslab
sudo -i
cd /home/pi/nodejs-gp sudo node main.js
edit fe/js/main.js
edit main.js
browser @ 192.168.1.123
Full project @ https://github.com/braceslab/nodejs-gp