New Version of canned, with custom return code support

Canned is now 0.2.0, this has been the start of a major internal refactor, so it is no longer just one big ball of JavaScript but starting to have some internal structure.
A major new feature is the support for specifying the return code inside the file, so special codes like 201 for create etc. can now simply be added via //! statusCode: 201.
For anybody who likes to help the tests got some love as well and are now in more friendly jasmine and hopefully easier to understand than before.

Enjoy!

Canned has been updated

I have used canned for some time now
to aid my development of apis, and over time some things arouse which made it
worth to add some features. If you want to know more about canned check out
the introduction

Changes canned 0.1.0

  • better error codes, a not found is actually 404 now not 400
  • better content type handling, html is now returned as text/html
  • support for comments in json, so documenting api responses can be done inline

interested install the new version via

$ npm install canned

And checkout the the repo

Growling from Node … or why is Array.pack missing from Javascript?

Since it came out I’ve been really interessed in Node. So I decided to do something with it, and to get me started I hacked together a little module to allow me to do what every good programming environment should allow: Sent me some Growl notifications :D…

Nodejs growl.png

This involved some rather low level UDP packet construction, but for now it works. Maybe somebody will find it useful, I put the code up on Github.

While writing the module I realized I was missing one piece coming from network coding using ruby, Array.pack(format) why is this missing? Is there an alternative? How do I turn an Array into a buffer following some custom format? Well for now I solved this by a little hacked function extending Array, this is neither clean nor well tested but it works for me while looking for a way to this right. For anyone interested here it is, and don’t kill me cause it’s ugly

https://gist.github.com/734947.js

Enjoy.