### Yapp simple example

Yaws applications is built on the OTP application concept, but this does not mean they need to be complex. In the simplest form an OTP applications is made of a .app description file and the necessary library files. There is no need to have application modules (application_app.erl), supervisors, gen_servers etc. unless they are really needed.

This application is a very simple example and contains only two files:

    yapp_ex_1/ebin/yapp_ex_1.app       - otp .app file
    yapp_ex_1/priv/docroot/index.yaws  - yaws file

The index.yaws file contains this text and the script part:

    out(A) ->
        Header = "Cache-Control:no-store",
        [X] = string:tokens(yapp:prepath(A),"/"),
        [{header, Header},
         {ehtml, [{p,[],  X ++ " there"}]}].

Which gives URL path to that dispatches to the application appended with "there":

<erl> out(A) -> Header = "Cache-Control:no-store", [X] = string:tokens(yapp:prepath(A),"/"), [{header, Header}, {ehtml, [{p,[], X ++ " there"}]}]. </erl>

The default text will be "yapp_ex_1 there" but if you register your yapp under another path, e.g. "hi" will get another outcome. Note that you can register your yapp under several virtual hosts and use different dispatch paths.