Category Archive: Node.js

Mar 22

A Pattern for handling concurrent edits to a MongoDB Document in Node.js

Lately I’ve been working on converting my space strategy game (Astriarch) to multiplayer using Node.js, Mongodb, and Mongoose. One problem I faced while making the game multiplayer is handling concurrent edits to the mongo game documents. Here is the scenerio: two players decide to send ships (edit the document) at the same time. If we …

Continue reading »

Apr 23

Create your first Node Module and publish it to the NPM registry

NPM Init

Installing Node Modules through NPM NPM is the Node Package Manager, it makes it easy to install external libraries and frameworks for use in your own projects. With NPM installed you can simply type: npm install module-name Upon running this command, npm will fetch that module from the repository and place it within the “node_modules” …

Continue reading »

Mar 23

Installing and switching between multiple versions of Node.js: n vs. nvm

The need for a Node Version Manager Sometimes it is necessary to be able to quickly switch between versions of Node.js without having to uninstall and reinstall a new version. Perhaps one project is written for an older version of Node.js and works on that version, but you’d like to easily test it against a …

Continue reading »

Nov 09

Getting started with Node.js, Express and Jade using the WebStorm IDE

Node.js Over the last few weeks I’ve been experimenting with Node.js and learning about how to use some of the great packages written for it. Node.js is a popular framework for building scalable server-side applications in JavaScript. To achieve high concurrency and scalability, Node.js leverages JavaScript’s event loop and function callbacks for longer running processes …

Continue reading »