Explore the introductions below and discover what you
can do with Helma and Javascript on the server-side.



Every request a Helma application receives is handled by an "action" associated with the requested URL. For example, a request to http://serverjs.org/example will be handled by the "example" action, defined at ./apps/welcome/code/Root/example.hac

res.write('Hello, this is the action defined \
    at ./apps/welcome/code/Root/example.hac');

The file example.hac contains the Javascript code that Helma will evaluate when handling that request. In this example, the code inside the example.hac file automatically becomes a prototype method with an "_action" suffix. By leveraging such conventions, Helma allows you to structure your code in clean and uncluttered ways. Alternatively, you can also define actions in generic Javascript files, an examples of which can be found in ./apps/welcome/code/Root/example.js and tested via the URL http://serverjs.org/anotherexample

function anotherexample_action() {
    res.write('Hello again, this is the action \
        defined in ./apps/welcome/Root/example.js');

Requests that do not specify a particular action are handled by the "main" action. For example, a request to http://serverjs.org/ will be handled by the "main" action, defined at ./apps/welcome/code/Guide/main.hac

More information about the way Helma handles requests and maps them to actions, and how Helma maps directories and filename extensions to objects in the Javascript environment: