background preloader

NodeJS

Facebook Twitter

Kriskowal/q. Les promesses avec Q et nodejs. Les promesses avec Q et nodejs Lorsque l’on commence à monter une application web qui tourne sous node, avec quelques requêtes http sur un autre serveur et une persistance dans une base mongodb on est vite pris par l’enfer des callbacks (en anglais callback hell et qu’on trouve également sous le nom de Pyramid of Doom). La solution la plus courante est d’utiliser les promesses. Simple… sur le papier en tout cas. Car dès que l’on dépasse le stade des 2-3 promesses à lancer l’une à la suite de l’autre on peut vite se retrouver à imbriquer des promesses les unes dans les autres, exactement comme on cherchait à ne pas faire avec les callbacks. Les promesses permettent de construire un enchaînement d’actions, synchrones ou asynchrones. Cette chaîne d’actions peut être interrompue si une des actions échoue (créé une erreur) ou se réaliser entièrement quelque soient les retours de chaque action. Installation Voici les dépendances du projet, listées dans le fichier package.json : Avec les promesses.

Node.js on the Road: Node.js @ Yahoo - Developer Center. Like we were pretty early adopters for it. But when we saw that transition, we knew like this stuff is getting pretty solid, and so we started putting a lot of stuff on it. A lot of the new Yahoo-based products that you've seen, our properties, digital magazines, we have Yahoo Tech, David Pogue is now at Yahoo, writing for Yahoo Tech; and Yahoo Food, and these are more advanced single page applications, but also work as content sites, it's a nice hybrid. Those are being served through Node. Yahoo Answers, famous for awesome answers, uses Node on some parts of it. So Flickr is going through re-writing a lot of the stuff that they have, they actually are in a state where they have a hybrid application.

So, we're using it a lot. Yes, it definitely is. Makes it very easy to scale horizontally, which we definitely have to do at Yahoo. So what are we using it for? So it's what all of us are used to. [audience] Yahoo is getting married? No, no, no, for my wedding website. Node.js on the Road: Node.js & Yahoo - Developer Center. Slack line not pictured but it's pretty cool. I work at this little known startup that no one's ever heard of, and so when I was approached about this talk, about giving this talk, they wanted to me to focus a lot on production use of Node, and that's awesome.

We use it in production, so I have a lot to talk about, but I thought it would be useful to explain to this audience that production at Yahoo has meant something different than production at other companies I worked at at the past. And the big thing about this, is most people think of production as something that keeps your company running, and at Yahoo, this means stuff that people actually use and what makes Yahoo money, right? So this is what production is, but it's also for us, we have a lot of engineers—thousands and thousands of engineers, and it's very important that we keep them productive and working, and that's a big part of what my job is all about. Sometimes that's newer, sometimes it's very old. So, security. Episodes - Learn All The Nodes.

10 Best Node.js MVC Frameworks for JavaScript Developers » CODECALL. Node.js is one of the most popular javascript framework that allows you to build scalable network web applications. Node.js contains different kinds of framework, such as MVC framework, full-stack framework, REST API and generators. They are included as server libraries, which allows Node.jsto run a web server without the use of external software like Apache and Lighttpd. These frameworks make it user-friendly and allows it to support a large number of features and functions to develop huge web applications in just a few steps. Last week, we introduced some of the best javascript frameworks for web developers. Today, we are going to share some selected web frameworks of Node.js. 1) A Node.js Framework – Sails js Sails is an excellent framework that makes it easy to develop custom, enterprise-grade, and modern Node.js apps. 2) A Node.js Framework – Total js Total.js is another great framework for Node.js that helps to create web pages and web applications. 4) A Node.js Framework – Koa js.

26 modules Node.js que j’utilise tout le temps. Je suis comme vous, je reviens toujours à une petite boîte à outils essentielle, qui m’accompagne de projet en projet, chaque outil ayant maintes fois prouvé sa valeur. C’est notamment le cas pour les modules Node.js. Je me suis dit que ça pouvait vous intéresser de savoir lesquels j’utilise. Utilitaires généraux Quelques modules utiles vraiment partout tout le temps. underscore Que je soie côté client ou serveur, si je suis en JavaScript, j’ai Underscore sous la main. Debug Lorsqu’on souhaite gérer intelligemment ses messages de débogage, une plâtrée de console.debug ou même console.log n’est guère suffisante… Il est préférable de se caler sur les modules noyaux et conventions Node, et d’utiliser un flux de sortie contextualisé et sensible à la variable d’environnement DEBUG (les modules noyaux de Node utilisent NODE_DEBUG).

On crée un logger de debug contextualisé comme ceci : Après quoi on s’en sert comme d’un appel console.debug, avec les mêmes paramètres, par exemple : colors rsvp q-io nconf. Node Js. How to Build A Slackbot + Deploy an App to Heroku... Back in ye olde days of the internet, there was IRC (Internet Relay Chat), a chat network with channels and servers for every microcosm in the world. Folks would make these little bots or services — they’d greet you when you joined a channel, played trivia, Uno and other chat-based games with you. Unfortunately, if you wanted to make one yourself, you likely needed some knowledge of Perl, client-server architecture and a handful of Unix commands.

Today, most will opt for a more aesthetic alternative to IRC. Namely, Slack — a chat-based team communication tool. The best part? I’ll try not to make assumptions on the technologies you may or may not have on your machine here. Setup 1. Mac Go to nodejs.org, Click ‘install’, and run through the install process. 2. 3. Git clone git@github.com:ceejbot/LOUDBOT-SLACK.git 4. Pheew. Add Slack Tokens to Our App 1. 2. 3. 4. 5. Cat .env.example > .env 6. 7. 8. 9. Deploy Our Slackbot to Heroku 2. 3.

Heroku create git add git commit -m "my commit message" "Automatisez votre startup" par Julien Le Coupanec. Npm2dot. Convert npm dependency list to graphviz format Convert npm dependency list to dot file which can be visualized using graphviz Install npm install npm2dot -g Usage 1. In a Node.js package folder, type in console: npm ls --json | npm2dot 2. Digraph{ root="debug@2.2.0" "debug@2.2.0" -> "N_1" "N_1"[label="ms@0.7.1",style="filled",fillcolor="0.06666666666666667 1 1"] 3. Npm ls --json | npm2dot | dot -Tpng -o debug.png -Grankdir=LR Picture debug.png is very simple because debug has only one dependency: That's how npm2dot interacts with npm ls and Graphviz.

Use Case 1 : Comparison of folder structure installed separately using NPM2 and NPM3 NPM3 is currently in beta, one of the most expected feature is flatten structure : Dependencies will now be installed maximally flat. Using npm2dot and Graphviz will help you clearly understand this change: npm ls --json | npm2dot | twopi -Tsvg -o /tmp/twopi.svg -Granksep=4 Result: Before, the dependencies is install with npm@2.x In express folder, execute About 1. 2. 3. Node Logging Basics - Ultimate Guide to Logging. Node provides an easily extensible logging system, allowing you to control which messages get logged and to where they are output.

Additionally, it has good support for structured logging using JSON. JSON allows more advanced logging patterns such as recording data fields for analysis and extending log objects to track complex call graphs. We’ll give examples for each of these in the sections below. There are a large number of third-party logging libraries available for Node.js. In this guide, we’re going to look at three: Winston, Bunyan, and Node-Loggly. Winston “A multi-transport async logging library for node.js” Winston is the most popular logging library available for Node.js. Use multiple transportsCreate custom transportsStream logsQuery logsPerform profilingHandle exceptionsUse one of a range of pre-defined error levelsCreate custom error levels Morgan Morgan is another HTTP request logger middleware for Node.js. Bunyan “A simple and fast JSON logging module for node.js services” Web Development with Node and Express: Leveraging the JavaScript Stack - Ethan Brown.

Dominos. API for domino's Pizza This is a node.js wrapper for the Domino's pizza API's This work is licenced via the DBAD Public Licence. npm install dominos By Postal Code this yields the least accurate information dominos.store.find( '20500', function(storeData){ console.log(storeData); } ); By City and Postal Code this yields less accurate information but is better than just using the postal code dominos.store.find( 'Beverly Hills 90210', function(storeData){ console.log(storeData); } ); Using Full or Nearly Full Address this yields the best information and sorts stores by actual distance dominos.store.find( '1600 Pennsylvania Ave NW, 20500', function(storeData){ console.log(storeData); } ); //Get Store Info for Store #4336 dominos.store.info( 4336, function(storeData){ console.log(storeData); } ); //Get Menu for Store #4336 dominos.store.menu( 4336, function(storeData){ console.log(storeData); } ); By Phone dominos.track.phone( 2024561111, function(pizzaData){ console.log(pizzaData); } ); By orderKey.

NodeJS. GRUNT TUTORIAL - Grunt makes your web development better! DailyNode - The most timely and complete Node aggregator. Node.js. Home · koajs/koa Wiki. Node.js démystifié • Christophe Porteneuve @ Paris Web 2014. En voiture Simone ! Express Le principal framework web de base C’est une surcouche du module connect qui gère les piles de middlewares, lui-même construit par-dessus le module natif http de Node. Système d’applis modulaires, routage par méthode et chemin, système de vues et moteurs de templates.

Logging Avec morgan Histoire d’avoir des logs HTTP basiques pour bien voir nos requêtes, on va rajouter un middleware « natif » (quand même un module à part) : morgan. Propose plusieurs formats pré-définis, souvent inspirés d’Apache, et bien sûr on peut définir nos propres formats. Templating Avec Jade Langage de templating à indentation significative Un peu comme HAML et Slim Mécanisme d'extensions et de blocs, plus balèze qu'une simple inclusion dans un layout Il faut indiquer à Express un moteur par défaut Recharger le code avec nodemon Ctrl+C / Flèche haute / Entrée, ça va bien 5 minutes… Nodemon permet de relancer une commande dès que la surveillance de fichiers détecte un changement Pas que Node, en fait.

Node.js. NodeSchool. Node.js. Tutoriel vidéo NodeJS : Créer un tchat avec NodeJS et Socket.IO. Premiers pas avec Grunt. Nous vous conseillons aujourd’hui d’utiliser un gestionnaire de tâches qui nous paraît être mieux sur bien des points: configuration plus souple, lisible et facile et rapidité vous attendent avec Gulp. Vous avez sûrement déjà entendu parler de Grunt à droite à gauche, en conférence, voire votre boite l’utilise déjà mais vous ne savez toujours pas trop ce qui se cache derrière ce terme saugrenu digne d’un personnage de Warcraft. Soit, ce n’est pas bien grave. Grunt est simplement un JavaScript Task Runner, un outil vous permettant de créer des tâches automatisées en JavaScript. Forcément ce n’est pas très parlant mais c’est tout l’intérêt de cet article, vous expliquer ce qu’est Grunt et pourquoi il peut vous être utile dans un workflow de front-end dev.

Vous est-il déjà arrivé de devoir régulièrement lancer, lancer et relancer des processus tels que Sass, LESS, uglify - en somme des préprocesseurs ou des minifiers - régulièrement à la main ? Voici un workflow assez classique : $ npm init. Felix's Node.js Beginners Guide. « Home / All Guides There is lots of information about node.js, but given the rapid pace at which it is developing, it can be difficult for beginners to find good, current information on how to get started. This guide aims to provide exactly that, whilst staying updated with the latest stable version of node.js. This guide has been updated to reflect the latest changes in node 0.4.x, the currently stable branch of node.js. Learning JavaScript This guide assumes that you are already familar with JavaScript. If you are not, you should go ahead and read: Eloquent JavaScript, a free online book by Marijn Haverbeke. Hello World Tutorial This tutorial guides you through installing node.js, including the creation of a simple hello world http server.

Installation First of all: You should run a *nix operating system in order to use node.js at this point. The most common way to install node.js is to directly compile it from the downloaded source code. You can get the latest source code from nodejs.org. NodeJS en mode démoniaque avec upstart sous Debian. Comment installer NodeJS sur Debian et le faire tourner comme un démon, avec démarrage automatique. On va utiliser, sur un petit VPS, une install propre de nodejs et l'utilitaire upstart. Ce mini-tuto est un pas vers la mise en production de serveurs nodejs.

Installer NodeJS sur Debian Mettre à jour la liste des paquets, procéder aux mises à jour. apt-get updateapt-get upgrade Installer des utilitaires de compilation (nécessaires lors de l'installation de modules npm). apt-get install build-essential Installer curl, un utilitaire réseau apt-get install curl Télécharger et exécuter le script d'installation de nodejs. Curl -sL | bash - Une fois l'opération terminée, il faut lancer l'installation effective de nodejs apt-get install nodejs Installer l'utilitaire de compilation de modules node-gyp (sans quoi certains modules node ne pourront pas être installés via npm) npm install -g node-gyp mkdir /var/www/ se placer dans le dossier créé cd /var/www npm install express #!

Underscore.js. Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It’s the answer to the question: “If I sit down in front of a blank HTML page, and want to start being productive immediately, what do I need?” … and the tie to go along with jQuery's tux and Backbone's suspenders. Underscore provides over 100 functions that support both your favorite workaday functional helpers: map, filter, invoke — as well as more specialized goodies: function binding, javascript templating, creating quick indexes, deep equality testing, and so on. The project is hosted on GitHub. Collection Functions (Arrays or Objects) _.each(list, iteratee, [context]) Alias: forEach Iterates over a list of elements, yielding each in turn to an iteratee function.

Note: Collection functions work on arrays, objects, and array-like objects such as arguments, NodeList and similar. . _.every([true, 1, null, 'yes'], _.identity); => false Chaining. NodeSchool. Functional Javascript Learn fundamental functional programming features of JavaScript in vanilla ES5. npm install -g functional-javascript-workshop Level Me Up Scotty! Learn to use leveldb, a simple key/value store with a vibrant package. npm install -g levelmeup ExpressWorks Learn the basics of the Express.js framework. npm install -g expressworks Make Me Hapi Learn all about hapi through a series of challenges. npm install -g makemehapi Promise It Won't Hurt Learn to use promises in JavaScript to handle async operations. npm install -g promise-it-wont-hurt Async You Learn to use the async package. npm install -g async-you NodeBot Workshop Make robots with the johnny-five api. npm install -g nodebot-workshop Going Native An exploration of Node.js from the underside: native C++ add-ons. npm install -g goingnative Planet Proto Understanding JavaScript Prototypes npm install -g planetproto WebGL Workshop Learn the basics of WebGL in small, manageable chunks. npm install -g webgl-workshop ESNext Generation learn-sass.

Package.json: an interactive guide - browsenpm.org.

Express

Node.js Paris. Dynamisez vos sites web avec Javascript ! Conjugaison : travailler, finir, prendre ou aimer ? Pogoapp. Node Hosting · joyent/node Wiki. How To Use node.js, request and cheerio to Set Up Simple Web-Scraping. jOWL - semantic javascript library. Details | Sencha Ext JS. Tool nodejs for scrapping. Spider aspirateur de donnée. Drichard/mindmaps. Docs. Ghost - Just a blogging platform. Use jitsu to deploy your Node.js applications on Nodejitsu | Nodejitsu Inc. Authentification et WebSocket, avec Node.JS, Express, et Socket.IO | naholyr.fr. Intro to Sails.js.

JSDB.io - The Database of JavaScript Libraries. Strongloop/express. Passport | Authenticate. Developers. Comment télécharger un fichier avec Node.js ? - Social Mobile dev. Zooniverse/Ubret-Dashboard. Useful Node.js Tools, Tutorials And Resources. Andzdroid/mongo-express. Etabits/node-penguin. Anephenix/dashku. How do I get started with Node.js. Senchalabs/connect. Référence JavaScript. Flickr Services. Oauth-signature. Passport - Simple, unobtrusive authentication for Node.js. 2.0 — OAuth. Andreassolberg/jso.

t1msh/node-oauth20-provider. Package.json: an interactive guide - browsenpm.org. Nipster! npm search tool for Node.js. Compound. Npm. Node for Rails developers: using Compound.js. Créer un site simple avec Node.js, Express et Jade - Code4fun - Dev Blog. CompoundJS. Instance Node.js. Chat Realtime avec Node.js et Socket.io | Partie 1. Session-based Authorization with Socket.IO. FR . Node.js – Veille techno – Communauté – Google+