• Node.js: exports vs module.exports

    What is the difference between exports and module.exports in Node.js? Let's first take a look at what the module object is all about. Create a file named run.js with the following content.

  • Node.js: Publishing an npm package

    How to publish a Node.js module on npm Before you can publish your Node.js module on npm, you have to create one. If you don't know how to create one, read "Node.js: Writing modules". Assuming you ar...

  • Node.js: Directory references

    Understanding directory references in Node.js So, there are three different ways to refer to directories in Node.js; namely - dot notation (./ and ../), __dirname, and process.cwd(). While all of the...

  • Node.js: Writing modules

    How to create Node.js modules A Node.js module is a standalone JavaScript program which exposes an object that can be imported and used by other programs. The object exposed by the module can be of a...

  • Global variables in Node.js

    How to create global variables in Node.js So you are working with a set of Node modules, maybe a framework like Express.js, and suddenly feel the need to make some variables global. How do you make v...

  • Node.js UDP server and client example

    How create UDP server and client on Node.js Here is a quick tutorial on setting up a UDP server and client in Node.js. For all things UDP in Node.js, you will need to use the dgram library, so read i...