Friday, September 28, 12
WER BIN ICH?    • Sebastian            Springer    • https://github.com/sspringer82    • @basti_springer    • Teamlead    ...
WER SEID IHR?Friday, September 28, 12
LET’S GOFriday, September 28, 12
THEMEN    • Installation                   • Dateisystem    • Kernkomponenten                • Datenbanken    • Beispiel  ...
INSTALLATIONFriday, September 28, 12
v0.8.11                                v0.8.10                           NODE-V0.8.9Friday, September 28, 12
PAKETE  • Unix      http://nodejs.org/dist/v0.8.9/node-v0.8.9-linux-x64.tar.gz  • Mac      http://nodejs.org/dist/v0.8.9/n...
HTTP://NODEJS.ORG/                             DOWNLOAD/Friday, September 28, 12
SOURCEFriday, September 28, 12
HAT ES GEKLAPPT?Friday, September 28, 12
DIE KERNKOMPONENTENFriday, September 28, 12
V8    • Schneller            Zugriff auf Eigenschaften    • Dynamische              Erstellung von Maschinencode    • Garb...
V8 - FAST PROPERTY ACCESSFriday, September 28, 12
V8 - FAST PROPERTY ACCESSFriday, September 28, 12
V8 - FAST PROPERTY ACCESSFriday, September 28, 12
MASCHINENCODEFriday, September 28, 12
V8 - GARBAGE COLLECTION    • Programmausführung           wird angehalten    • Es        wird nur ein Teil des Object Heap...
LIBEV         • Full-featured        and high-performance event loop         • libevent        als Basis         • Alles, ...
LIBEIO    • Eventbasierte           Bibliothek für asynchrone I/O Operationen    • Ergänzung            zu libev    • Feat...
C-ARES    • asynchrone           DNS Auflösung    • Modul: dnsFriday, September 28, 12
EVCOM    • Basiert              auf libev    • Eventbasierte               Library für Stream Sockets    • Modul: netFrida...
EIN KLEINES BEISPIELFriday, September 28, 12
INTERAKTIVFriday, September 28, 12
WEBSERVERFriday, September 28, 12
WEBSERVERFriday, September 28, 12
WEBSERVERFriday, September 28, 12
MODULEFriday, September 28, 12
VERFÜGBARE MODULE    • Stream                           • OS    • Events                           • Debugger    • File   ...
HTTP://NODEJS.ORG/API/Friday, September 28, 12
STABILITÄTSINDEX    •0       - Deprecated    •1       - Experimental    •2       - Unstable    •3       - Stable    •4    ...
STABILITÄTSINDEXFriday, September 28, 12
MODULE VERWENDENFriday, September 28, 12
EIGENE KLASSEN DEFINIERENFriday, September 28, 12
...IM BROWSERFriday, September 28, 12
...IN NODE                             Human.jsFriday, September 28, 12
...IN NODE                              server.jsFriday, September 28, 12
ASYNCHRONE                           PROGRAMMIERUNGFriday, September 28, 12
DATEI LESEN                           node.js   Betriebssystem                                               Leseoperation...
DATEI LESENFriday, September 28, 12
DATEI LESENFriday, September 28, 12
DATEI LESENFriday, September 28, 12
Friday, September 28, 12
NPM    • Node                 Package Manager    • Seit          node 0.6.3 Bundled    • Repo                 @ https://np...
KOMMANDOS    • npm             search <package>    • npm             install <package>    • npm             list    • npm ...
NPM SEARCHFriday, September 28, 12
NPM INSTALLFriday, September 28, 12
NPM LISTFriday, September 28, 12
NPM UPDATEFriday, September 28, 12
NPM REMOVEFriday, September 28, 12
EIGENE NPM PAKETEFriday, September 28, 12
EIGENE NPM PAKETE    • npm                  adduser         • Username, Passwort, E-Mail    • npm                  publish...
HTTPS://GITHUB.COM/                            JOYENT/NODE/WIKI/Friday, September 28, 12
DATEISYSTEMFriday, September 28, 12
DATEISYSTEM-FUNKTIONEN    • exists               • unlink    • readFile             • chmod    • writeFile            • ch...
FILE EXISTSFriday, September 28, 12
FILE EXISTSFriday, September 28, 12
FILE EXISTSFriday, September 28, 12
APPEND FILEFriday, September 28, 12
APPEND FILEFriday, September 28, 12
APPEND FILEFriday, September 28, 12
WATCH FILEFriday, September 28, 12
WATCH FILEFriday, September 28, 12
WATCH FILEFriday, September 28, 12
WATCH FILEFriday, September 28, 12
FRAGEN?Friday, September 28, 12
DATENBANKENFriday, September 28, 12
Friday, September 28, 12
MySQLFriday, September 28, 12
MySQL                                   CouchDBFriday, September 28, 12
MySQL                                       CouchDB                       MS SQL ServerFriday, September 28, 12
MySQL                                       CouchDB                  SQLite                       MS SQL ServerFriday, Sep...
MySQL                                       CouchDB                                                 Redis                 ...
MySQL                                       PostgreSQL                                       CouchDB                      ...
MySQL                                       PostgreSQL                                       CouchDB                      ...
MySQL                                       PostgreSQL                              Mongo                                 ...
MySQL                                       PostgreSQL                                                        Oracle      ...
MYSQL    • npm             install mysql    • Implementierung                 des mysql ProtokollsFriday, September 28, 12
MYSQLFriday, September 28, 12
TEST-DATENBANKFriday, September 28, 12
MYSQLFriday, September 28, 12
MYSQLFriday, September 28, 12
PROMISESFriday, September 28, 12
PROMISES    • Ergebnis             eines asynchronen Funktionsaufrufs    • Rückgabewert               oder Exception    • ...
PYRAMID OF DOOMFriday, September 28, 12
PROMISESFriday, September 28, 12
PROMISE-LIBRARIES    • https://github.com/kriskowal/q    • https://github.com/kriszyp/promised-io    • https://github.com/...
OHNE PROMISESFriday, September 28, 12
OHNE PROMISESFriday, September 28, 12
PROMISESFriday, September 28, 12
PROMISESFriday, September 28, 12
PROMISESFriday, September 28, 12
PROMISESFriday, September 28, 12
CHILD PROCESSESFriday, September 28, 12
CHILD PROCESSES    • spawn                - Kommandoausführung    • exec            - Kommandoausführung in Puffer    • ex...
ETWAS RECHENINTENSIVESFriday, September 28, 12
potenziell                    ETWAS BLOCKIERENDESFriday, September 28, 12
ETWAS BLOCKIERENDESFriday, September 28, 12
ETWAS BLOCKIERENDESFriday, September 28, 12
DIE LÖSUNG: WIR FORKENFriday, September 28, 12
CHILD PROCESSESFriday, September 28, 12
CHILD PROCESSESFriday, September 28, 12
CHILD PROCESSESFriday, September 28, 12
WEBSOCKETSFriday, September 28, 12
WEBSOCKETS    • Protokoll               auf TCP-Basis    • Bidirektionale              Client-Server-Kommunikation    • Wi...
Friday, September 28, 12
SOCKET.IO - SERVERFriday, September 28, 12
SOCKET.IO - SERVERFriday, September 28, 12
SOCKET.IO - CLIENTFriday, September 28, 12
SOCKET.IO - CLIENTFriday, September 28, 12
SOCKET.IO - CLIENTFriday, September 28, 12
SOCKET.IO - SERVERFriday, September 28, 12
DEBUGGERFriday, September 28, 12
DEBUGGERFriday, September 28, 12
DEBUGGERFriday, September 28, 12
DEBUGGERFriday, September 28, 12
DEBUGGER - STEP    • next            -n    • cont            -c    • step           -s    • out          -oFriday, Septemb...
DEBUGGER - WATCH    • watch(expression)    • unwatch(expression)    • watchersFriday, September 28, 12
DEBUGGER - WATCHFriday, September 28, 12
DEBUGGER - REPLFriday, September 28, 12
TESTINGFriday, September 28, 12
TEST FRAMEWORKS    • node-unit    • node             assertion testing    • jasmine-nodeFriday, September 28, 12
JASMINE-NODEFriday, September 28, 12
JASMINE-NODEFriday, September 28, 12
JASMINE-NODE                             src/Calculator.jsFriday, September 28, 12
JASMINE-NODE                            spec/Calculator.spec.jsFriday, September 28, 12
JASMINE-NODEFriday, September 28, 12
JASMINE-NODEFriday, September 28, 12
FRAGEN?Friday, September 28, 12
KONTAKT                           Sebastian Springer                           sebastian.springer@mayflower.de            ...
SOCKETSFriday, September 28, 12
SOCKETS    • Kommunikation          über Netzwerk-/Datei-Sockets    • Read-, Write-        und Read-Write-Sockets    • ‘ne...
SOCKETS         Write-Socket- Daten               Daten Read-Socket-                             Socket-Server            ...
SOCKETS - SERVERFriday, September 28, 12
SOCKETS - READFriday, September 28, 12
SOCKETS - WRITEFriday, September 28, 12
SOCKETS - SERVERFriday, September 28, 12
SOCKETS - SERVERFriday, September 28, 12
SOCKETS - SERVERFriday, September 28, 12
SOCKETS - SERVERFriday, September 28, 12
Upcoming SlideShare
Loading in...5
×

Node jsworkshop

2,291

Published on

Workshop auf den JavaScript-Days 2012 in Berlin.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,291
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Node jsworkshop

  1. 1. Friday, September 28, 12
  2. 2. WER BIN ICH? • Sebastian Springer • https://github.com/sspringer82 • @basti_springer • Teamlead @ MayflowerFriday, September 28, 12
  3. 3. WER SEID IHR?Friday, September 28, 12
  4. 4. LET’S GOFriday, September 28, 12
  5. 5. THEMEN • Installation • Dateisystem • Kernkomponenten • Datenbanken • Beispiel • Promises • Module • Child Processes • Eigener Code • Websockets • Asynchronität • Debugger • NPM • TestingFriday, September 28, 12
  6. 6. INSTALLATIONFriday, September 28, 12
  7. 7. v0.8.11 v0.8.10 NODE-V0.8.9Friday, September 28, 12
  8. 8. PAKETE • Unix http://nodejs.org/dist/v0.8.9/node-v0.8.9-linux-x64.tar.gz • Mac http://nodejs.org/dist/v0.8.9/node-v0.8.9.pkg • Windows http://nodejs.org/dist/v0.8.9/x64/node-v0.8.9-x64.msiFriday, September 28, 12
  9. 9. HTTP://NODEJS.ORG/ DOWNLOAD/Friday, September 28, 12
  10. 10. SOURCEFriday, September 28, 12
  11. 11. HAT ES GEKLAPPT?Friday, September 28, 12
  12. 12. DIE KERNKOMPONENTENFriday, September 28, 12
  13. 13. V8 • Schneller Zugriff auf Eigenschaften • Dynamische Erstellung von Maschinencode • Garbage CollectionFriday, September 28, 12
  14. 14. V8 - FAST PROPERTY ACCESSFriday, September 28, 12
  15. 15. V8 - FAST PROPERTY ACCESSFriday, September 28, 12
  16. 16. V8 - FAST PROPERTY ACCESSFriday, September 28, 12
  17. 17. MASCHINENCODEFriday, September 28, 12
  18. 18. V8 - GARBAGE COLLECTION • Programmausführung wird angehalten • Es wird nur ein Teil des Object Heaps geprüft • V8 kennt alle Objekte und Pointer im SpeicherFriday, September 28, 12
  19. 19. LIBEV • Full-featured and high-performance event loop • libevent als Basis • Alles, außer der eigene Code ist parallel und asynchronFriday, September 28, 12
  20. 20. LIBEIO • Eventbasierte Bibliothek für asynchrone I/O Operationen • Ergänzung zu libev • Features: Öffnen, Lesen, Schreiben, Löschen, etc. • Modul: fsFriday, September 28, 12
  21. 21. C-ARES • asynchrone DNS Auflösung • Modul: dnsFriday, September 28, 12
  22. 22. EVCOM • Basiert auf libev • Eventbasierte Library für Stream Sockets • Modul: netFriday, September 28, 12
  23. 23. EIN KLEINES BEISPIELFriday, September 28, 12
  24. 24. INTERAKTIVFriday, September 28, 12
  25. 25. WEBSERVERFriday, September 28, 12
  26. 26. WEBSERVERFriday, September 28, 12
  27. 27. WEBSERVERFriday, September 28, 12
  28. 28. MODULEFriday, September 28, 12
  29. 29. VERFÜGBARE MODULE • Stream • OS • Events • Debugger • File System • Cluster • Net • Util • HTTP • Buffer • Child Processes • UDPFriday, September 28, 12
  30. 30. HTTP://NODEJS.ORG/API/Friday, September 28, 12
  31. 31. STABILITÄTSINDEX •0 - Deprecated •1 - Experimental •2 - Unstable •3 - Stable •4 - API Frozen •5 - LockedFriday, September 28, 12
  32. 32. STABILITÄTSINDEXFriday, September 28, 12
  33. 33. MODULE VERWENDENFriday, September 28, 12
  34. 34. EIGENE KLASSEN DEFINIERENFriday, September 28, 12
  35. 35. ...IM BROWSERFriday, September 28, 12
  36. 36. ...IN NODE Human.jsFriday, September 28, 12
  37. 37. ...IN NODE server.jsFriday, September 28, 12
  38. 38. ASYNCHRONE PROGRAMMIERUNGFriday, September 28, 12
  39. 39. DATEI LESEN node.js Betriebssystem LeseoperationFriday, September 28, 12
  40. 40. DATEI LESENFriday, September 28, 12
  41. 41. DATEI LESENFriday, September 28, 12
  42. 42. DATEI LESENFriday, September 28, 12
  43. 43. Friday, September 28, 12
  44. 44. NPM • Node Package Manager • Seit node 0.6.3 Bundled • Repo @ https://npmjs.org/Friday, September 28, 12
  45. 45. KOMMANDOS • npm search <package> • npm install <package> • npm list • npm update • npm removeFriday, September 28, 12
  46. 46. NPM SEARCHFriday, September 28, 12
  47. 47. NPM INSTALLFriday, September 28, 12
  48. 48. NPM LISTFriday, September 28, 12
  49. 49. NPM UPDATEFriday, September 28, 12
  50. 50. NPM REMOVEFriday, September 28, 12
  51. 51. EIGENE NPM PAKETEFriday, September 28, 12
  52. 52. EIGENE NPM PAKETE • npm adduser • Username, Passwort, E-Mail • npm publish <folder>|<tarball>Friday, September 28, 12
  53. 53. HTTPS://GITHUB.COM/ JOYENT/NODE/WIKI/Friday, September 28, 12
  54. 54. DATEISYSTEMFriday, September 28, 12
  55. 55. DATEISYSTEM-FUNKTIONEN • exists • unlink • readFile • chmod • writeFile • chown • appendFile • ... • watchFile • renameFriday, September 28, 12
  56. 56. FILE EXISTSFriday, September 28, 12
  57. 57. FILE EXISTSFriday, September 28, 12
  58. 58. FILE EXISTSFriday, September 28, 12
  59. 59. APPEND FILEFriday, September 28, 12
  60. 60. APPEND FILEFriday, September 28, 12
  61. 61. APPEND FILEFriday, September 28, 12
  62. 62. WATCH FILEFriday, September 28, 12
  63. 63. WATCH FILEFriday, September 28, 12
  64. 64. WATCH FILEFriday, September 28, 12
  65. 65. WATCH FILEFriday, September 28, 12
  66. 66. FRAGEN?Friday, September 28, 12
  67. 67. DATENBANKENFriday, September 28, 12
  68. 68. Friday, September 28, 12
  69. 69. MySQLFriday, September 28, 12
  70. 70. MySQL CouchDBFriday, September 28, 12
  71. 71. MySQL CouchDB MS SQL ServerFriday, September 28, 12
  72. 72. MySQL CouchDB SQLite MS SQL ServerFriday, September 28, 12
  73. 73. MySQL CouchDB Redis SQLite MS SQL ServerFriday, September 28, 12
  74. 74. MySQL PostgreSQL CouchDB Redis SQLite MS SQL ServerFriday, September 28, 12
  75. 75. MySQL PostgreSQL CouchDB Redis SQLite MS SQL Server HiveFriday, September 28, 12
  76. 76. MySQL PostgreSQL Mongo CouchDB Redis SQLite MS SQL Server HiveFriday, September 28, 12
  77. 77. MySQL PostgreSQL Oracle Mongo CouchDB Redis SQLite MS SQL Server HiveFriday, September 28, 12
  78. 78. MYSQL • npm install mysql • Implementierung des mysql ProtokollsFriday, September 28, 12
  79. 79. MYSQLFriday, September 28, 12
  80. 80. TEST-DATENBANKFriday, September 28, 12
  81. 81. MYSQLFriday, September 28, 12
  82. 82. MYSQLFriday, September 28, 12
  83. 83. PROMISESFriday, September 28, 12
  84. 84. PROMISES • Ergebnis eines asynchronen Funktionsaufrufs • Rückgabewert oder Exception • Promise statt Blocking • CommonJS Proposal • bis 0.2 Bestandteil von NodeFriday, September 28, 12
  85. 85. PYRAMID OF DOOMFriday, September 28, 12
  86. 86. PROMISESFriday, September 28, 12
  87. 87. PROMISE-LIBRARIES • https://github.com/kriskowal/q • https://github.com/kriszyp/promised-io • https://github.com/kriszyp/node-promise • ...Friday, September 28, 12
  88. 88. OHNE PROMISESFriday, September 28, 12
  89. 89. OHNE PROMISESFriday, September 28, 12
  90. 90. PROMISESFriday, September 28, 12
  91. 91. PROMISESFriday, September 28, 12
  92. 92. PROMISESFriday, September 28, 12
  93. 93. PROMISESFriday, September 28, 12
  94. 94. CHILD PROCESSESFriday, September 28, 12
  95. 95. CHILD PROCESSES • spawn - Kommandoausführung • exec - Kommandoausführung in Puffer • execFile - Dateiausführung in Puffer • fork - Node ProzessFriday, September 28, 12
  96. 96. ETWAS RECHENINTENSIVESFriday, September 28, 12
  97. 97. potenziell ETWAS BLOCKIERENDESFriday, September 28, 12
  98. 98. ETWAS BLOCKIERENDESFriday, September 28, 12
  99. 99. ETWAS BLOCKIERENDESFriday, September 28, 12
  100. 100. DIE LÖSUNG: WIR FORKENFriday, September 28, 12
  101. 101. CHILD PROCESSESFriday, September 28, 12
  102. 102. CHILD PROCESSESFriday, September 28, 12
  103. 103. CHILD PROCESSESFriday, September 28, 12
  104. 104. WEBSOCKETSFriday, September 28, 12
  105. 105. WEBSOCKETS • Protokoll auf TCP-Basis • Bidirektionale Client-Server-Kommunikation • Wird im Rahmen von HTML5 entwickelt • Unterstützung durch LibrariesFriday, September 28, 12
  106. 106. Friday, September 28, 12
  107. 107. SOCKET.IO - SERVERFriday, September 28, 12
  108. 108. SOCKET.IO - SERVERFriday, September 28, 12
  109. 109. SOCKET.IO - CLIENTFriday, September 28, 12
  110. 110. SOCKET.IO - CLIENTFriday, September 28, 12
  111. 111. SOCKET.IO - CLIENTFriday, September 28, 12
  112. 112. SOCKET.IO - SERVERFriday, September 28, 12
  113. 113. DEBUGGERFriday, September 28, 12
  114. 114. DEBUGGERFriday, September 28, 12
  115. 115. DEBUGGERFriday, September 28, 12
  116. 116. DEBUGGERFriday, September 28, 12
  117. 117. DEBUGGER - STEP • next -n • cont -c • step -s • out -oFriday, September 28, 12
  118. 118. DEBUGGER - WATCH • watch(expression) • unwatch(expression) • watchersFriday, September 28, 12
  119. 119. DEBUGGER - WATCHFriday, September 28, 12
  120. 120. DEBUGGER - REPLFriday, September 28, 12
  121. 121. TESTINGFriday, September 28, 12
  122. 122. TEST FRAMEWORKS • node-unit • node assertion testing • jasmine-nodeFriday, September 28, 12
  123. 123. JASMINE-NODEFriday, September 28, 12
  124. 124. JASMINE-NODEFriday, September 28, 12
  125. 125. JASMINE-NODE src/Calculator.jsFriday, September 28, 12
  126. 126. JASMINE-NODE spec/Calculator.spec.jsFriday, September 28, 12
  127. 127. JASMINE-NODEFriday, September 28, 12
  128. 128. JASMINE-NODEFriday, September 28, 12
  129. 129. FRAGEN?Friday, September 28, 12
  130. 130. KONTAKT Sebastian Springer sebastian.springer@mayflower.de Mayflower GmbH Mannhardtstr. 6 80538 München Deutschland @basti_springer https://github.com/sspringer82Friday, September 28, 12
  131. 131. SOCKETSFriday, September 28, 12
  132. 132. SOCKETS • Kommunikation über Netzwerk-/Datei-Sockets • Read-, Write- und Read-Write-Sockets • ‘net’-ModulFriday, September 28, 12
  133. 133. SOCKETS Write-Socket- Daten Daten Read-Socket- Socket-Server Client ClientFriday, September 28, 12
  134. 134. SOCKETS - SERVERFriday, September 28, 12
  135. 135. SOCKETS - READFriday, September 28, 12
  136. 136. SOCKETS - WRITEFriday, September 28, 12
  137. 137. SOCKETS - SERVERFriday, September 28, 12
  138. 138. SOCKETS - SERVERFriday, September 28, 12
  139. 139. SOCKETS - SERVERFriday, September 28, 12
  140. 140. SOCKETS - SERVERFriday, September 28, 12
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×