Oni Apollo 0.13: 'Official' NodeJS-based server-side support

October 06, 2011 by Alexander Fritze

We're pleased to announce the release of version 0.13 of our multi-platform StratifiedJS implementation Oni Apollo.

Apollo 0.13 is the first version with 'official' server-side support, based on nodejs.

To execute StratifiedJS files on the server run the apollo executable:

Usage: apollo [options] [script.sjs [arguments]]

Without a script.sjs argument you get dropped into a stratified REPL.

Options:
  -h, --help        display this help message
  -e, --eval STR    evaluate STR

You can execute apollo straight from Apollo's root directory. The only dependency is that you need to have a recent version of nodejs installed.

Apollo's module system has been made to work seamlessly on the client and server, and most modules of the Apollo Standard Module Library work fine in either environment. E.g. the following code can run in the browser or on the server:

require('apollo:twitter').get('onilabs');

Of course you can also use any nodejs module in server-side Apollo programs:

// load socket.io (if installed via npm):
require('nodejs:socket.io');

// load node's builtin 'path' module:
require('nodejs:path');

// for builtins 'nodejs:' scheme is optional:
require('path');

For an example of a more substantial server-side StratifiedJS program you can take a look at the rocket webserver.