Can I use CoffeeScript instead of JS for node.js?
What are my restrictions if I want to code node.js and use CoffeeScript? Can I do anything I’d be able to do in JS? 8 Answers 8
What are my restrictions if I want to code node.js and use CoffeeScript? Can I do anything I’d be able to do in JS? 8 Answers 8
For someone who is coming from PHP background the process of killing node and starting it again after every code change, seems very tedious. Is there any flag when starting a script with node to automatically restart node when code change is saved? 8 Answers 8
I need to upload an image to NodeJS server to some directory. I am using connect-busboy node module for that. I had the dataURL of the image that I converted to blob using the following code: dataURLToBlob: function(dataURL) { var BASE64_MARKER = ‘;base64,’; if (dataURL.indexOf(BASE64_MARKER) == -1) { var parts = dataURL.split(‘,’); var contentType = … Read more
Why is it possible to call function in JavaScript like this, tested with node.js: ~$ node > function hi() { console.log(“Hello, World!”); }; undefined > hi [Function: hi] > hi() Hello, World! undefined > hi)( // WTF? Hello, World! undefined > Why does the last call, hi)(, work? Is it bug in node.js, bug in … Read more
I am trying to get my node environment set up on a new Ubuntu 12.04 instance, with Node 0.8.14 already installed, but I ran into problems when I try to run npm install. So when I try npm install, it says that I need to run it as root or adminisrator: Error: EACCES, mkdir ‘/usr/local/lib/node_modules/coffee-script’ … Read more
I periodically run into the problem, having to spin up old Angular projects with deprecated dependencies of Angular. Because I unsually run the latest Node.js version (at least lates LTS version) I often had the problem, that I wasn’t able to get the old projects running. I solved this by using a node version manager, … Read more
I’m using the node_swiz module, which in turn uses the validator module. I want to make changes to the validator module, but I used npm install to install the modules/dependencies. Can I just make changes to the validator module inside of node_modules, or will that node_modules dependencies be re-created and the latest version gotten when … Read more
I am trying to get the sum of 1 + 2 + … + 1000000000, but I’m getting funny results in PHP and Node.js. PHP $sum = 0; for($i = 0; $i <= 1000000000 ; $i++) { $sum += $i; } printf(“%s”, number_format($sum, 0, “”, “”)); // 500000000067108992 Node.js var sum = 0; for (i … Read more
Is it possible to print an objects contents e.g. methods and attributes in Node.js? At the moment I’m trying to print the session object and get the following: console.log(“Session:” + session); > Session:[object Object] Maybe in a similar way to print_r(array) in PHP, or using .toString in Java. 8 Answers 8
I’m trying to get a list of all the sockets/clients that are currently connected. io.sockets does not return an array, unfortunately. I know I could keep my own list using an array, but don’t think this is an optimal solution for 2 reasons: Redundancy. Socket.IO already keeps a copy of this list. Socket.IO provides method … Read more