node.js

Preventing XSS in Node.js / server side javascript

Hi all, Any idea how one would go about preventing XSS attacks on a node.js app? Any libs out there that handle removing javascript in hrefs, onclick attributes,etc. from POSTed data? I don't want to have to write a regex for all that :) Any suggestions? ...

Cannot understand node.js.

Hi, From someone with few experience in JS, what do you recommend for learning Node.js? I read a lot in the forum about event driven, non-blocking , async, callbacks, etc but I don't know what's that! Where can I learn the basics in order to understand all that terms and in the future, node.js? Thanks! ...

Node.js base64 encode a downloaded image for use in data URI

Using Node v0.2.0 I am trying to fetch an image from a server, convert it into a base64 string and then embed it on the page in an image tag. I have the following code: var express = require('express'), request = require('request'), sys = require('sys'); var app = express.createServer( express.logger(), express.bodyDecoder() );...

Help me rewrite this regex to not match tags with attributes?

========================================================================= EDIT: I'm using node.js, so I don't have access to the DOM, and parsing with an HTML parser is not an option (it's not efficient enough to justify parsing through such a small amount of text) =======================================================================...

nodejs/express testing

im writing an app with express. main file is called server.js one of the objects is var app = express.createServer(express.logger(), express.bodyDecoder()); then i have app.get("/",function(req, res){ res.send("Running"); } how do i use expresso, [or any other testing framework for that matter], to test the routes output? I looked a...

How do you set up npm (node package manager) without root access?

Setting npm up as the root user is straighforward and workds. Except you have to run npm commands as root (not recommended). So I thought I'd try setting it up as a non-root user. According to npm documentation, a non-root user without root access can set up npm by: creating a .npmrc file with root, binroot, and manroot pointing to...

Advice on creating a micro-framework in JavaScript

Hi, I'd like to know what are the steps required to create a framework on top of node.js. I believe this can be a good way to learn, that's why I'm doing this! I've been checking other micro-frameworks and bigger frameworks but I'm not being able to understand where to start. I'd like your advice on this. Thank you. Edit: MVC Framewor...

Can node.js execute JavaScript functions pulled from CouchDB like CouchApp does? How?

The quick overview is this: for my web app I can write most of my functionality using CouchApp and CouchDB views, etc. I love the feature of CouchApp that pushes my code up to the server via replication- this makes the deployment cycle very easy. However, to do some arbitrary work not supported in couchdb and works around a few limita...

Node.js ajax file uploader

Hi, I am trying to make a node.js file uploader with a ajax progress bar. var formidable = require('./formidable'), http = require('http'), sys = require('sys'); http.createServer(function(req, res) { if (req.url == '/upload' && req.method.toLowerCase() == 'post') { // parse a file upload var form = new formidable.IncomingFo...

Can node.js replace Ruby?

Hi, I'd like to know if it's possible to create a complete website using node.js (just like we do using Sinatra and Rails). Also, is there any framework as good as Sinatra and Rails? Is this the best use for node? Regards. ...

When to use node.js vs sinatra vs rails?

Hi, What are the best uses for these 3 languages/frameworks? Is it useful to mix all of them (or 2)? ...

TCP packet splitting in node.js

I'm implementing a server in node.js for a protocol that has unterminated packets. i.e: _________________________________________________________________________ | packet type | string length 1 | string 1 | string length 2 | string 2 | So I don't know the length of the packet until it has been fully parsed. This causes problems, becau...

Managing Sessions in NodeJS?

What is the best way to manage session variables in nodejs? is there a lib? ...

Encoding and decoding IEEE 754 floats in JavaScript

I need to encode and decode IEEE 754 floats and doubles from binary in node.js to parse a network protocol. Are there any existing libraries that do this, or do I have to read the spec and implement it myself? Or should I write a C module to do it? ...

Node.js, how to avoid event namespace conflict ?

In Android, intent action string is always prefixed with package name to avoid conflict. what is the pattern in node.js ? ...

Including other libraries / files / plugins with nodejs and NPM

I'm using OSX 10.5 and playing around with Nodejs. I've managed to install npm and used it to install a couple of plugins. Well at least the installation says it has worked fine but when I try and load them in I get an error $npm install htmlparser Installs ok, then I create a file called test with var htmlparser = require("node-htm...

how node.js server is better than thread based server

Node.js server is works on event based models where callback functions are supported. But I am not able to understand how is it better than traditional thread based servers where threads wait for system IO. In case of thread based model, when a thread needs to wait for IO, it gets preempted so doesn't consume CPU cycles hence doesn't con...

What server side solution did Google Wave used?

I wonder what server side solution Google used for Google Wave. I have heard that they used Node.js for this. Is that true? Or did they use other non-open source solutions? ...

Event loop is in the same thread as Node.js main?

So Node.js uses event loop for non-blocking IO. I wonder if that event loop is in the same thread as Node.js main for handling requests? ...

AMQP/RabbitMQ or Node.js for live web applications?

I want to build a live application that supports server-push (chat, feeds, live notification and collaboration etc). I have looked into Node.js and found it quite interesting and appropriate for such things. I have also looked into AMQP/RabbitMQ, but I don't get these quite. My questions: How does AMQP/RabbitMQ compare to Node.js? C...