Nodepad Resurrection
When I sign in to GitHub I keep noticing new watchers appear on the Nodepad project (it’s currently at 207 watchers). Although the Let’s Make a Web App tutorials have already noticably aged (particularly as Mongoose changed drastically in the middle of the series), I thought I’d give the Nodepad followers something to look at!
I updated the libraries by editing package.json:
- Express went from 2.2.2 to 2.4.x with no major API changes
- Mongoose has gone from 1.2.0 to 2.0.3 without much trouble
- Jade, Stylus and connect-mongodb have also been updated. Again, no major API changes affected Nodepad
Upgrading modules is a common task when maintaining production Node apps. Keeping tight versions in package.json can feel like a pain at times, but it’s really important for keeping production and staging environments sane and working with other people.
Backbone
I’ve updated Backbone.js to 0.5.3. This version has API changes, but the only one that affected us was a naming change from refresh to reset:
We’ve taken the opportunity to clarify some naming with the 0.5.0 release.
Controlleris now Router, andrefreshis now reset. The previoussaveLocationandsetLocationfunctions have been replaced by navigate.Backbone.sync’s method signature has changed to allow the passing of arbitrary options tojQuery.ajax. Be sure to opt-in topushStatesupport, if you want to use it.
While I was updating the client-side code I improved the ‘empty state’ handling. Now when first logging in, Nodepad will behave much better. There’s no-longer a different add document view when creating the first document, in fact it’s now possible to just press ‘Save’ right away (an empty document will be created, but it makes more sense than the old version).
Summary
The main Nodepad resurrection commit was 56f7554:
- Client-side sorting uses
toLowerCase - Most persistent views are now on AppView
- Nobody keeps document model references around unless they need them directly
- Added
selectedDocumentto track the currently viewed document - Changed
refreshtoresetto support Backbone 0.5.0+ - Improved new account handling by handling an empty document list correctly
And I followed that up with the library updates. See the full history here: Nodepad commit history.
Hopefully this will make Nodepad a little less confusing for people just discovering the tutorials and app!
