Open main menu

Wikibooks β

Erlang Programming/Creating Web Applications with yaws/Appmod

< Erlang Programming‎ | Creating Web Applications with yaws

Yaws have different ways of creating web applications. We have already been familiarized with one way as presented previously in the simple Hello world example, by embedding Erlang code in a .yaws file amongst the html. Another way is to create an appmod. Like embedded Erlang code in .yaws files the appmod is called through the an out/1 function with the arg data structure as parameter.

All appmod applications has to be precompiled and placed in one of the directories specified in the global configurations by an "ebin_dir = /directory" configuration parameter. Then in the virtual host configuration, an appmod has to be specified by two parameters such, "appmods = <myappmod, module>". Whenever the URI contains myappmod the module:out/1 will be called with the arg data structure as parameter.