Node Toy is like an instant server-side. Its a REST interface that accepts and returns JSON to any ol’ URL (that starts with /data/), And it also hosts your HTML etc at /app/
Quite often when developing front end code that calls a JSON interface I create flat files with extension .json and have a local Apache instance serve the files on given URLs with the correct mime/type. This means you can concentrate on the front end code HTML and JS while the backend is being worked on by someone else, or by you at a later date.
Node Toy is built with this in mind but talking JSON in both directions, you can POST any old blob of JSON to a URL and the node server will save it and make it available for a subsequent GET. If you GET to a directory, not a file, you get a listing back of all the *.json files.
I have done the same job in the past with a tomcat server but thats a big chunk of RAM you might not be happy to give up. A node server takes up about as much RAM as a tab in chrome.
Its not a bad idea to follow REST principals for larger applications. To test the concept I knocked up a todo list in just front end code HTML/JS/CSS. The resulting code was hacked out fast, but its not that bad and it proves that not all APPs need a hefty backend, but almost all of them need some kind of persistence. Persistence is the one thing that a browser does not give you. I guess modern browsers do give you persistence but I like to be able to see and back up my data and not have to worry about it dissappearing when you flush the caches or upgrade the version. Node toy stores the files as flat files in the file system.
Last edited by teknopaul,