Présentation de Node.js

Post on 04-Jul-2015

391 views 0 download

description

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

Transcript of Présentation de Node.js

PRÉSENTATION

Mickael Couzinet Jeudi 15 Mars 2012

HISTOIRE

CREATION

Ryan DAHL

Début du projet : 16 février 2009

AUJOURD’HUI

KEZAKO ?

UN SERVEUR JAVASCRIPT

- RAPIDE

- ECRIT EN C/C++

- MOTEUR V8 DE GOOGLE POUR LE JS

- GROSSE COMMUNAUTE

- ENCORE TRES JEUNE

ARCHITECTURE

V8THREAD

POOL

EVENT

LOOP

INTERFACE NODE

LIBRAIRIES NODE

GESTION DES THREADS

WebApp Node Machine

Requete

#1

Requete

#2

Appel#1

Reponse#1

Appel#2

Reponse#1

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

LES MODULES

NODE PACKET MANAGER

- Plus de 6000 modules disponibles

- Installation des modules faciles

- Mise à jour en une ligne de commande

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);

SOCKET.IO

- WebSocket

- Adobe® Flash® Socket

- AJAX long polling

- AJAX multipart streaming

DÉMONSTRATION

QUESTIONS ?

QUESTIONS ?