Outils du site

Pluie en novembre, Noël en décembre [Inconnu]

56-tools:node

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
56-tools:node [2016/12/21 01:58] – [async & co] Roge56-tools:node [2017/11/26 18:02] (Version actuelle) – [Child Process] Roge
Ligne 28: Ligne 28:
  
  
 +===== install nodejs =====
 +
 +https://nodesource.com/blog/installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu/
  
 ===== express ===== ===== express =====
Ligne 86: Ligne 89:
  
  
-===== pug (jade) =====+===== pug (former jade) =====
  
  
Ligne 230: Ligne 233:
  
 [[http://caolan.github.io/async/docs.html|async]] //Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. // [[http://caolan.github.io/async/docs.html|async]] //Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. //
 +
 +<code:js>
 +'use strict';
 +var async = require("async");
 +
 +function makeLoopFunction(label, val) {
 + return function(callback) {
 + // console.log(label+val);
 + return callback(null, {'val': val, 'label': label});
 + };
 +}
 +
 +function done (err, result) {
 + console.log('cbk done: '+result.length);
 + console.log(result);
 +}
 +
 +var funcs = [];
 +for(var i = 0; i < 3; i++) {
 + funcs.push(makeLoopFunction('test 5: ', i));
 +}
 +async.parallel(funcs, done);
 +// cbk done: 3
 +// [ { val: 0, label: 'test 5: ' },
 +//   { val: 1, label: 'test 5: ' },
 +//   { val: 2, label: 'test 5: ' } ]
 +</code>
  
  
Ligne 259: Ligne 289:
 // [ 30, 60 ] // [ 30, 60 ]
 </code> </code>
 +
 +===== Desktop app =====
 +
 +
 +  * Electron (ex Atom shell): http://github.com/electron/electron ou http://electron.atom.io/ 
 +     * Exemples: https://github.com/hokein/electron-sample-apps 
 +
 +  * NW.js (ex Node webkit): http://nwjs.io/ 
 +
 +[[https://github.com/electron/electron/blob/master/docs/development/atom-shell-vs-node-webkit.md | Electron vs NW.js]]
 +
 +===== Child Process =====
 +Permet d'exécuter des commandes systèmes.
 +
 +
 +https://medium.freecodecamp.org/node-js-child-processes-everything-you-need-to-know-e69498fe970a
 +
 +
 +===== PM2: production process manager for Node.js =====
 +
 +
 +http://pm2.keymetrics.io/
Dernière modification : 2017/10/06 23:38