mod_js

JavaScript Projects:

JSTT
(JavaScript Template Toolkit)
A more fully featured Template system than Trimpath

Note:This project was never actively developed, and was only a toy. If you want something like this but actively developed, I suggest looking at Flusspferd or one of the projects from CommonJS.

What? Are you mad?

Yes, we quite probably are. But not as mad as some people.

mod_js is a standalone module for Apache (1.3 currently, v2 module will be coming soonv2 now) that allows you to execute JavaScript (technically it’s ECMAScript) on the server.

In its current form it is just a very simple proof of concept. Consider the following example:

// Populates params variable from request.env.QUERY_STRING
include('/Users/tomi/Sites/scripts/util.js');

print("<html><head>");

print("<title>Page title here</title>");

print("</head>");

print("<body>");

print("<pre>");
tree( params, "params");
print("</pre>");

// You can print E4X objects
print(<form method="get">
<input name="value" />
<input type="submit" />
</form>);

print("<pre>\n");
tree( this, "this" );

print("</body></html>");

If you have ever used perl’s CGI.pm, this might look familiar to you. As it should - it’s loosely what we based the interface on.

Source

If you really want to look at how we did it, you can look at the subversion server. To try it out yourself:

svn co http://www.modjs.org/svn/trunk/mod_js
autoconf
./configure
make
sudo make install

(Until the code is in a situation to actually be useful, there wont be a dist available, and as such you will need autoconf.)

The code for mod_js is dual licenced under GPLv3 and Apache License 2.0.

Authors

Ash Berlin and Tom Insam wrote mod_js as a simple proof of concept during one of Fotango’sFotango (which has since shutdown. Shame) hack days. Our thanks go out to Fotango for being enlightened enough to let us have hack days, and to release this. Thanks.