Overview
JaxServer is an open-source web application server, and lightweight development framework, for NodeJS. Together with it's template engine (JXP), JaxServer can be largely described as a reimaging of Java servlets, and Java server pages, but entirely implemented in JavaScript.
This table shows how JaxServer & JXP fit in the spectrum of web development frameworks:
| MVC Framework | Spring | ASP.net | Symfony | Ruby on Rails | Django | JaxServer |
|---|---|---|---|---|---|---|
| Language | Java | VB,C# | PHP | Ruby | Python | JavaScript |
| Platform | JVM | CLR | Apache HTTP | Ruby MRI | CPython | NodeJS + V8 |
| Package Manager | Jar | n/a | PEAR | Ruby Gems | PyPM | NPM |
| Webserver | Apache Tomcat | IIS | Apache HTTP | WEBrick | Tornado | JaxServer |
| Templates | JSP | ASP | PHP | eRuby | Django | JXP |
JaxServer was authored by Dan Steinman, founder of Jaxcore a web software research and development startup based out of Guelph, Ontario, Canada. JaxServer, is the open-source webserver component of a larger effort to develop a next-generation client-server application platform using JavaScript, HTML5, NodeJS, and related mobile/web technologies. JaxServer shares part of it's codebase with JaxScript, a client-side, general purpose JavaScript library which is shared between all of Jaxcore's web applications.
Supported Platforms
Any platform on which NodeJS runs can run JaxServer:
- Linux (x86 & ARM)
- Mac OSX
- iOS (iPhone, iPod, iPad)
- Windows (experimental)
JaxServer Features
- Command line utilities:
jax create myapp jax run myapp
- Log4J-style logging:
jax.log.info("opening file"); jax.log.error("An error as occured"); - Controllers (the "C" in MVC):
function MyController() { jax.server.Controller.call(this, arguments, __dirname); this.get('/',function(request,response) { jax.server.sendHTML(request,response,"Hello World"); }); } Helloworld.prototype = new jax.server.Controller(); - JaxServer Pages (the "V" in MVC):
<p>Today's date is <%= new Date() %></p>
- Template Includes/Imports:
<%@ import "mylibrary.js" %> <%= include("mytemplate.jxp", {data:123}); %> - Cookies & Sessions:
<%= cookie.set("pagecount",count+=1); %> <%= session.username %> - SSL / HTTP Secure servers
- Virtual Hosts
- Static File & Gzip support
NodeJS Modules
JaxServer relies on NodeJS for its system access, including all file I/O, network, and database support. In order to build a database powered web application, you will also need to become familiar with at least some of the many NodeJS modules. There are now modules for nearly every possible server-side requirement you may have.
JaxServer is also not the only choice for NodeJS development, there are also many other alternative web frameworks in constant development.
Recommended NodeJS Modules:
- node.bcrypt.js - for storing hashed passwords
- node-sqlite - SQLite driver
- UglifyJS - JavaScript minification
JaxServer does not include a modelling/ORM framework, leaving that task up to the developer. New document-based databases such as CouchDB provide a good alternative to traditional relational databases and are sometimes a great match for the type of large scale, real-time applications that can be built using NodeJS.
NodeJS Module Usage: JaxServer namespaces all of NodeJS's built-in modules as a global system.* package. This is not standard among other libraries and is only used from within JaxServer's codebase. Applications written using JaxServer should use the default require() function to include third-party modules and libraries.
Websocket Support
Jaxcore's websocket framework, as part of JaxScript, has not been publicly released. But until then it is possible to use the following modules:
- LearnBoost's Socket.io
- Worlize's WebSocket-Node
- miksago's node-websocket
Example Applications
JaxServer is an experimental webserver and framework, most applications thus far have been tests in nature.
- hellojax - the massive reference application documented throughout this guide
- todo-lite - reference crud app written using a SQLite database
- blog-couch - reference crud app written using a CouchDB database
- QR Replicator - QR code generator and replicator
- This website is written as a JaxServer application
Let us know if you build and launch an applicaiton and we'll include it here!
License & Support
JaxServer is open-source, in the hopes that others can benefit from it as we have benefited from its underlying technologies. You are free to use, modify, and redistribute JaxServer under the terms of the GNU Affero General Public License. The AGPL is a slightly modified version of the more common GPL3 license with some additional requirements, see LICENSE for complete details.
We appreciate bug reports which can be sent to our github issues page.
Jaxcore provides commercial support and licensing of JaxServer as well as general JavaScript, HTML5 and NodeJS consulting, contact us for details.
Acknowledgements
We would like to thank the following:
- Ryan Dahl, Joyent, and the NodeJS community for creating and supporting the NodeJS platform. It is truly a pleasure to develop applications using Node and its modules. It is hoped that JaxServer fills a need for those who require an application server based on NodeJS.
- Felix Geisendorfer - for the node-formidable module which is used by JaxServer to provide form processing and file uploads.
- Alex Gorbatchev - for SyntaxHighlighter which provides syntax highlighting in this tutorial and in JXP debugging
- Mark James - icon files from famfamfam.com are used in directory listings