I am used to a web UI programming model from Wicket, etc that allows you to define server-side behavior/event-handlers that are called when the user triggers an event on the client, with little or no client-side javascript in the markup.
These handlers are bound to the markup via the element id (in Wicket's case wicket:id). Simplified code would look something like this:
Scala:
add(new AjaxLink("mylink") {
override def onClick(target: AjaxRequestTarget) {
service.doSomething()
}
}
Template:
<a wicket:id="mylink">Click Me</a>
HTML rendered to client:
<a id="mylink" onclick="some-generated-ajax-call()">Click Me</a>
Is this approach possible in node.js or a related library? Is it clear what I'm asking?
The only examples I've seen focus on server-side request handlers, and I'm left with the impression folks need to hand-code ajax-calls, event-handlers, etc that call these server-side paths in the template with jQuery, etc.
The benefit is the template needs no logic, and is very easy to refactor, and you can give it to a web designer who knows nothing about the server-side logic or calls.
It looks like Meteor isn't using bindings or Ajax (according to the video) - I don't see it in the documentation but if it's pushing data to the client it's probably using websocks.
Why not use Meteor? The functionality can be replicated in NodeJS, sure, but it's already available in Meteor.
You could implement something like this if you'd want to use NodeJS: http://blog.new-bamboo.co.uk/2009/12/7/real-time-online-activity-monitor-example-with-node-js-and-websocket