Quantcast
Channel: javascript – frag (frăg)
Viewing all articles
Browse latest Browse all 37

Tooling for the node.js generation, part II

$
0
0

In the previous article, a number of things got covered that help with npm modules you’d want to use in your node.js projects. This is a continuation.

anything in a require() is an npm module, installable via npm install name

Interaction with the OS

  • require(‘node-growl’)
  • – Growl is a OSX style notification system, also available for windows or linux. node-growl abstracts having to deal with the different implementations of growl / messaging notifications between different operating systems and gives you a unified API.

var growl = require('growl');
growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true });

Serving HTTP and sockets

Often, you need to do quick prototypes, test APIs or work with a node.js backend altogether. This is a standard stack of tools that will cater for most of your needs

  • require(‘express’);Express.js is great tool that allows you to set a node.js HTTP server in no time. Works with the http stock npm as well as support for things like socket.io for streaming. Here’s an example express app for Epitome
  • require(‘socket.io’); – a sockets implementation available for the server and client with a wide browser support and graceful degradation by Guillermo Rauch. A viable alternative to Kaazing, no support for Binary Data Types yet
  • require(‘ws’);one of the fastest websockets implementations available, ws that also supports Binary Data.

Building / Generators

A lot of the time, you want to automate builds and processes.

  • require(‘requirejs’); – the npm version for the excellent AMD library is super cool, allowing you to use r.js functionality within your script and package/minify your scripts for production in a bespoke way with great control. It also allows you to use AMD modules instead of CJS, but that’s just silly, unless you want isomorphic code… How-to’s here. Also, read r.js instructions for CLI use.
  • require(‘grunt’);GruntJS is … something else. A fully blown task runner, Grunt provides a platform of config-based tasks that can aid your project in many things, including building, testing, linting, minfication, templating / generators, hot-reloaders and much more. Have a read, install grunt-cli and get going. P.S. sometimes, it is easier to do things w/o grunt, rather than figuring out how various grunt task runners work. Don’t use grunt for the sake of using grunt – use it when it makes sense. Make sure you scan the list of available grunt tasks before making your own.
  • Yeoman – a whole workflow manager, using Yo (template / generators), GruntJS and Bower for packaging. http://yeoman.io/ for hipster development. A must in your toolkit and a must on your C.V.

To be continued… WIP.


Viewing all articles
Browse latest Browse all 37

Trending Articles