Présentation de Node.js

16
PRÉSENTATION Mickael Couzinet Jeudi 15 Mars 2012

description

Présentation de l'environnement node.js lors des mini-conférences d'HETIC.

Transcript of Présentation de Node.js

Page 1: Présentation de Node.js

PRÉSENTATION

Mickael Couzinet Jeudi 15 Mars 2012

Page 2: Présentation de Node.js

HISTOIRE

Page 3: Présentation de Node.js

CREATION

Ryan DAHL

Début du projet : 16 février 2009

Page 4: Présentation de Node.js

AUJOURD’HUI

Page 5: Présentation de Node.js

KEZAKO ?

Page 6: Présentation de Node.js

UN SERVEUR JAVASCRIPT

- RAPIDE

- ECRIT EN C/C++

- MOTEUR V8 DE GOOGLE POUR LE JS

- GROSSE COMMUNAUTE

- ENCORE TRES JEUNE

Page 7: Présentation de Node.js

ARCHITECTURE

V8THREAD

POOL

EVENT

LOOP

INTERFACE NODE

LIBRAIRIES NODE

Page 8: Présentation de Node.js

GESTION DES THREADS

WebApp Node Machine

Requete

#1

Requete

#2

Appel#1

Reponse#1

Appel#2

Reponse#1

Page 9: Présentation de Node.js

PROGRAMMATION NON BLOQUANTE

---------BLOQUANT--------------------------------------------------

var fichier1 = readFyle(“fichier1.txt”);Console.log(“Lecture fichier1”);var fichier2 = readFyle(“fichier2.txt”);Console.log(“Lecture fichier2”);

-> Lecture fichier1 Lecture fichier2

----------NON-BLOQUANT-----------------------------------------

var fichier1 = readFyle(“fichier1.txt”,function(err,data){Console.log(“Lecture fichier1”);});var fichier2 = readFyle(“fichier2.txt”,function(err,data){Console.log(“Lecture fichier2”);});

-> Lecture fichier2 Lecture fichier1

On lit deux fichiersLe premier étant Plus lourd que le

second

Page 10: Présentation de Node.js

LES MODULES

Page 11: Présentation de Node.js

NODE PACKET MANAGER

- Plus de 6000 modules disponibles

- Installation des modules faciles

- Mise à jour en une ligne de commande

Page 12: Présentation de Node.js

EXPRESS

- Framework ‘MVC ’

- Créé un environnement de dévellopement

- Facilite le développement d’application

var express = require(‘express’);var app = express.createServer();

app.get('/', function(req, res){res.send('Hello World');});

app.listen(3000);

Page 13: Présentation de Node.js

SOCKET.IO

- WebSocket

- Adobe® Flash® Socket

- AJAX long polling

- AJAX multipart streaming

Page 14: Présentation de Node.js

DÉMONSTRATION

Page 15: Présentation de Node.js

QUESTIONS ?

Page 16: Présentation de Node.js

QUESTIONS ?