Showing posts from September, 2014

doxli - a help utility for node modules on command line

Quite often I fire up the node REPL and pull in some modules I've written to use on the command line. Unfortunately I often forget the exact way to call the various functions in those modules (there are a lot) and end up doing something like foo.dosomething.toString() to see the source code and recall the function signature.

In the interest of making code as "self-documenting" as possible,  I wrote a small utility that uses dox to provide help for modules on the command line. It adds a help() function to a module's exported methods so you can get the dox / jsdoc comments for the function on the command line.

So now will return the description, parameters, examples and so on for the method based on the documentation in the comments.

It's still a bit of a work in progress, but it works nicely - provided you actually document your modules with jsdoc-style comments.

All the info is here:

REST API Best Practices 4: Collections, Resources and Identifiers

Other articles in this series:
REST API Best Practices: A REST Cheat SheetREST API Best Practices: HTTP and CRUDREST API Best Practices: Partial Updates - PATCH vs. PUT RESTful APIs center around resources that are grouped into collections. A classic example is browsing through the directory listings and files on a website like When you browse the directory listing, you can click through a series of folders to download files.  The folders are collections of CentOS resource files.

In Rest, collections and resources are accessed via HTTP URI's in a similar way:

members/ -- a collection of members
members/1 -- a resource representing member #1
members/2 -- a resource representing member #2

It may help to think of a REST collection as a directory folder containing files, although its highly unlikely that the member data is stored as literal JSON files on the server. The member data should be coming from a database, but from the perspective of a REST API, it look…