Hi all,
There has been some discussion about supporting JavaScript in Wildfly for a
while now, and as a result I have come up with a simple proof of concept of
the form I think this support could take.
At the moment this is actually not part of Wildfly at all, but rather a jar
file that you can include in your apps and allows you to register
JavaScript based handlers. These handlers can be mapped to URL's, and
inject container resources such as CDI beans and JNDI data sources. It also
provide some simple JavaScript wrappers to make some EE objects easier to
use from scripts.
At the moment handlers are mainly useful as REST endpoints, although if
there is interest I am planning on adding template engine support as well.
When combined with my external resources PR (
https://github.com/wildfly/wildfly/pull/7299) this allows for changes in
your script files to be immediately visible, without even needing to copy
to an exploded deployment.
I envisage the main use of this will not be creating node.js like apps that
are pure javascript, but rather to allow simpler parts of the app to be
written in JavaScript, and this avoiding the compile+redeploy cycle.
Full details are here:
https://github.com/undertow-io/undertow.js
I have an example of the Kitchen Sink quickstart that has been re-done to
use this here:
https://github.com/wildfly/quickstart/compare/master...stuartwdouglas:js#...
At this stage I am really not sure how this will evolve, or if it will go
anywhere, I am just putting it out there to get some feedback.
Stuart