Node.js Grand Prix

11

Click here to load reader

Transcript of Node.js Grand Prix

Page 1: Node.js Grand Prix

Node.js Grand Prix

Page 2: Node.js Grand Prix

Node.js Grand Prix

Firenze, 20/07/172 / 10

Page 3: Node.js Grand Prix

Sanfratello Simone

www.braceslab.com

3 / 10

Page 4: Node.js Grand Prix

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

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://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://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

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

backend

9 / 10

Page 10: Node.js Grand Prix

frontend

10 /10

Page 11: Node.js Grand Prix

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