node

Embracing the Power of Microservices with Node.js

Introduction to Microservices and Node.js In today’s fast-paced digital world, the need for scalable, efficient, and reliable web applications is more crucial than ever. This is where the concept of microservices comes into play, especially when combined with the robustness of Node.js. Microservices represent a shift from traditional monolithic architecture to a more modular approach,… Read more Embracing the Power of Microservices with Node.js

Error First Callbacks in Node JS

Callbacks are a systemic part of a Node.js application. A non-blocking well-balanced flow of controlled asynchronous modules is made possible by properly implemented callbacks. But what is “properly implemented”? Creating code that will scale with your projects means using a reliable protocol that is a well-known standard. The “error-first” callback (also known as an “error-back”,… Read more Error First Callbacks in Node JS

Iterate an array with a promise in javascript

Example of how to iterate an array with a promise It can be challenging to figure out how to iterate over an array of items with a promise. The following code takes a callback function that may or may not be a promise already. Once inside the PromiseForEach function, the callback will become a promise… Read more Iterate an array with a promise in javascript

[solved] devtool reloads if application writes to a file

If you are developing a node js application using devtool, you may experience a rather frustrating situation whereby you application stops without any traceable errors followed by a subsequent reload of the devtool. Why does devtool keep reloading when there are no errors? There is a likelyhood that you are experiencing this issue as you… Read more [solved] devtool reloads if application writes to a file

SOLVED: /usr/bin/env: node: No such file or directory

While working with NodeJS on an AWS Ubuntu 14 box, I got the following error: /usr/bin/env: node: No such file or directory On some Linux distributions, AWS in my case, there is a namespace issue which causes errors at times. The error is a result of some distributions installing NodeJS with the name nodejs as opposed to node. The… Read more SOLVED: /usr/bin/env: node: No such file or directory

Error: listen EADDRINUSE with NodeJS Server

EADDRINUSE indicates the port number that listen() is attempting to bind the server to is already in use. Sometimes, even though you have hit Control C a few times. Somehow nodejs is still running. My guess is that there are lingering processes from a faulty termination for whatever reason. How to fix Error: listen EADDRINUSE… Read more Error: listen EADDRINUSE with NodeJS Server

How to setup Node.js application server with port 80 

Port 80 Redirect port 80 to port 3000 with this command: sudo iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 3000 Then launch the Node.js application on port 3000. Now requests to port 80 will map to the nodejs application on port 3000. Edit the /etc/rc.local file and adding… Read more How to setup Node.js application server with port 80 

Error: listen EADDRINUSE

The npm web server is a very simple web server used in development and testing for delivering static files. While attempting to use start the npm web server you may see an error like this: at exports._errnoException (util.js:746:11) at Server._listen2 (net.js:1156:14) at listen (net.js:1182:10) at net.js:1280:9 at dns.js:85:18 at process._tickCallback (node.js:355:11) at Function.Module.runMain (module.js:503:11) at startup… Read more Error: listen EADDRINUSE

How To Fix: “Errno::ENOENT: No such file or directory @ rb_sysopen – undefined” Grunt Error

While setting up a grunt.js file, I ran into the following stubborn error. Running “sass:dist” (sass) task Errno::ENOENT: No such file or directory @ rb_sysopen – undefined Use –trace for backtrace. After having Googled several solutions to the problem. I ended up updating my Ruby and uninstalling and re-installing nodejs among other things. It turns… Read more How To Fix: “Errno::ENOENT: No such file or directory @ rb_sysopen – undefined” Grunt Error