background preloader

Understanding node.js - Debuggable Ltd

Understanding node.js - Debuggable Ltd
Node.js has generally caused two reactions in people I've introduced it to. Basically people either "got it" right away, or they ended up being very confused. If you have been in the second group so far, here is my attempt to explain node: It is a command line tool. "But I can do everything I need in: ruby, python, php, java, ... !". I hear you. "Get to the point!" Alright, I will. "Huh?" That's right, everything runs in parallel, except your code. The day starts by one servant waking up the king and asking him if he needs anything. Once a servant finishes a task, he lines up outside the kings quarter to report. Life is good, for the king's servants carry out all of his tasks in parallel, but only report with one result at a time, so the king can focus "That's fantastic, but could you quit the silly metaphor and speak geek to me?" Sure. var fs = require('fs') , sys = require('sys'); fs.writeFile('letter-to-princess.txt', ' You got it! "Very nice, but why should I use it?" Yes and no. No. --fg

node.js - Debuggable Ltd Posted on 24/9/09 by Felix Geisendörfer What happens if you take an insanely fast JavaScript engine and build an asynchronous I/O library around it? You get node.js, an up and coming project that brings you bloat-free server-side JavaScript. This enables you to write any kind of "backend" service with just a few lines of JavaScript. This code creates a new http server and tells it to listen on port 8000. However, during those 2 seconds the server will continue to accept new connections. Here is another chart from a req/sec benchmark among various server-side JS libs: Now you may think this is all very nice and stuff, but what do you actually need it for? Trying out node.js requires you to have a Linux/Unix machine but it's pretty much as simple as downloading the code and running: . The documentation is pretty excellent and there are lots of friendly people on the mailing list to help if you have any problems. I'd love to hear your thoughts on node.js and any questions you might have.

Curso de Introducción a node.js Curso de Introducción a node.js diciembre.19 Archivo de videos Descargar MP3s Luego del éxito del curso de Introducción a HTML5 el jueves 15 dimos un curso de introducción a node.js en vivo. Alrededor de 2000 personas en simultáneo disfrutaron del programa y tuvieron la oportunidad de adentrarse y aprender más del interesante mundo de node.js. Antes y después del programa @cvander estuvo compartiendo interesantes lecturas para sumergirnos en el mundo node.js de lleno: La expectativa y la repercusión del curso se hicieron notar a través de tweets que puedes ver en el storify del Resumen de la Introducción a node.js, así como los comentarios en la fanpage de #mejorandola en facebook. Entra con Twitter Entra con Facebook 14 Comentarios hola / enero.29 blabla Matts / enero.04 sticchimatias.com.ar Aca hay una referencia muy completa de javascript: Esta en ingles pero es muy tecnico y sencillo de entender. Bumiga / enero.04 luli / diciembre.28 cdr / diciembre.21 Doctore

The Node Beginner Book » A comprehensive Node.js tutorial About The aim of this document is to get you started with developing applications with Node.js, teaching you everything you need to know about "advanced" JavaScript along the way. It goes way beyond your typical "Hello World" tutorial. Status You are reading the final version of this book, i.e., updates are only done to correct errors or to reflect changes in new versions of Node.js. The code samples in this book are tested to work with Node.js version 0.10.12. This site allows you to read pages 1-21 of this book for free. Intended audience This document will probably fit best for readers that have a background similar to my own: experienced with at least one object-oriented language like Ruby, Python, PHP or Java, only little experience with JavaScript, and completely new to Node.js. Aiming at developers that already have experience with other programming languages means that this document won't cover really basic stuff like data types, variables, control structures and the likes.

Debugger Node.js v0.10.17 Manual Stability: 3 - Stable V8 comes with an extensive debugger which is accessible out-of-process via a simple TCP protocol. Node has a built-in client for this debugger. To use this, start Node with the debug argument; a prompt will appear: % node debug myscript.js < debugger listening on port 5858 connecting... ok break in /home/indutny/Code/git/indutny/myscript.js:1 1 x = 5; 2 setTimeout(function () { 3 debugger; debug> Node's debugger client doesn't support the full range of commands, but simple step and inspection is possible. For example, suppose myscript.js looked like this: x = 5;setTimeout(function () { debugger; console.log("world");}, 1000); console.log("hello"); Then once the debugger is run, it will break on line 4. The repl command allows you to evaluate code remotely. Watchers# You can watch expression and variable values while debugging your code. To start watching an expression, type watch("my_expression"). watchers prints the active watchers. Commands reference# Stepping# % . Info#

Diving into Node.js – Introduction & Installation Why I Need Something Like Node.js? First of all the use of some software is needed not because of itself, but because of the need of some specific functionality. In my case this was the need of real time news feed. Introducing Node.js Perhaps the best way do describe what is Node.js is from its about page. Node’s goal is to provide an easy way to build scalable network programs. In general Node is a program using the Google Chrome’s V8 JavaScript engine, which in turn is a program that can parse and execute code written in JavaScript. Such kind of application/server is Node.js. The way Node works, however is different from what we know from every other web server. Whenever a request comes to the server, it tries to return the response as fast as possible. Here the server doesn’t return immediately the response, but holds as long as possible until some “event” occurs. Typically this scenario can be simulated without Node, but as I said, with some disadvantages. Installing Node.js Summary

The Changelog If you hadn’t heard, JSON API is a format for building awesome APIs on top of JSON. You can see other posts tagged with JSON API here. Recently, a new project related to JSON API was released: Fortune.js. Fortune.js, a web framework for prototyping rich hypermedia APIs, allows you to rapidly prototype the server side of any JSON API api. Check it out: This will give you all the proper routes and format the responses in the right way to conform with the spec. If you didn’t guess, fortune.js makes heavy use of Node, so you can get it from npm: $ npm install fortune I am super pumped about projects like this, because it shows off the great benefits of standardizing around a type like JSON API.

El Libro para Principiantes en Node.js» Un tutorial completo de node.js Sobre el Tutorial El objetivo de este documento es ayudarte a empezar con el desarrollo de aplicaciones para Node.js, enseñándote todo lo que necesites saber acerca de JavaScript "avanzado" sobre la marcha. Este tutorial va mucho más allá del típico manual "Hola Mundo". Status Estás leyendo la versión final de este libro, es decir, las actualizaciones solo serán hechas para corregir errores o para reflejar cambiar en nuevas versiones de Node.js. Las muestras de código de este libro están probadas para funcionar con la versión 0.6.11 de Node.js. Audiencia Objetivo Este documento probablemente será mejor entendido por los lectores que tengan un trasfondo similar al mío: Programadores experimentados en al menos un lenguaje orientado al objeto, como Ruby, Python, PHP o Java; poca experiencia con JavaScript, y ninguna experiencia en Node.js. Estructura de este documento Empezaremos por mirar cómo el desarrollo en JavaScript en Node.js es diferente del desarrollo en JavaScript en un browser. Ok.

Felix's Node.js Guide Using Express.js for APIs | StrongLoop A few tips and libraries for creating and documenting RESTful APIs with Express.js. See a simple example app that incorporates some of these ideas. Two things really got me sucked into Express when I first started using it: Jade and Stylus. I can barely tolerate writing HTML and CSS any other way. These days I spend more time using Express for APIs that send nothing but JSON. Mongoose I’m assuming an API backed by MongoDB, and that we’re using Mongoose. express-mongoose I’m generally not a flow control library guy. The fact that it supports Promises is important to keep in mind, because it means you can create some fairly complex async stuff in your Mongoose models, and as long as it returns a Promise you keep the top layer routing/sending code really tidy. Mongoose Transforms I often find myself wanting to hide certain properties before they get sent across the wire. This is yet another way to avoid repetition at the route/controller levels of your app. Routing express-resource-new or

Related: