background preloader

NodeJS

Facebook Twitter

Testing

Smashing Node.js: JavaScript Everywhere (Smashing Magazine Book Series): Guillermo Rauch: 9781119962595: Amazon.com: Books. A quick example of circular dependency with node.js. This code will crash unexpectedly because module A is only partially loaded by C. Node.js Security Tips | via @codeship. Substack/stream-handbook. How To Node - NodeJS. Testing Your Model with Mocha, Mongo, and NodeJS. 11 min read Mongo is installed, our data is ported. Time to roll together our first model: the Customer. How do you model this stuff with MongoDB and Node? Choices and More Choices The good news when getting off the ground with NodeJS: if you like testing, there are many interesting and solid choices.

The ones I looked at are: Vows. I started off with Mocha - it came highly recommended and it supports a wide variety of options. You can choose other layouts if you like - there are plenty of options. --require should-R spec--ui bdd Mocha suggests strongly that you put your tests into a "/tests" directory right off your root. This is something you run into with Javascript: the asynchronous nature of the language means that sometimes the test will finish before the assertion is made - which is a false positive.

So I decided to try Vows. The first thing Dave did, upon reviewing my mess, to ask me Would you mind getting rid of the CoffeeScript so I can read this? Everything. Installs Customer Update. Managing Node.js projects for pythonists. Different languages, different toolsets. Classic. Nonetheless, if you look carefully, many tools available for language X are also available for language Y. This article will draft the similarities between the (core) Node.js toolset and their equivalent in Python. Installation Node.js should be installed using NVM. It is the preferred way because it allows all the packages and binaries to be available to the current user instead of being installed system-wide. quick tip: The installation process of NVM does not automatically install Node.js.

Binaries pip pip handles packages management for your projects. Python As for the python command in Python-land, the node command is a REPL that allows you to load execute Javascript code. Features comparable with Python virtualenv Virtualenv in Python allows to have scoped dependencies, libraries and binaries for a specific project. Pip freeze The pip freeze command outputs a new requirements.txt file with the exact versions of the currently used packages.