# Module yapp_handler

- Description
- Function Index
- Function Details

Yaws applications handler.

Introduced in: 1 Jun 2006 by Mikael Karlsson <mikael@creado.se>

Authors: Mikael Karlsson (`mikael@creado.se`).

See also: yapp, yapp_registry, yapp_server.

## Description

Yaws applications handler.

An easy way to deploy Yaws applications (Yapps) independently of each other. A Yapp is an Erlang application already installed, by for instance erlmerge.

To register a Yapp on the virtual server uses the command (example):

`yapp_handler:add(yapp_handler, "myvirtserverid","/myYappPath", my_app_name)`

where "myvirtserverid" is the the "server id" set in the opaque variable yapp_server_id in yaws.conf:

              <opaque>
                      yapp_server_id = myvirtserverid
              </opaque>

If Yaws is running on a different node use:

`yapp_handler:add({yapp_handler,'node@host'}, "myvirtserverid","/myYappPath", my_app_name)`

The default yapp_handler implementation is yapp_server.

The yapp_handler uses the yapp module to change the configuration on Yaws, and the yapp_registry module implementation to store the configuration.

## Function Index

add/3 | Add a Yapp.
add/4 | Add a Yapp.
init_yapps/1 | Iinitalizes the Yaws Sconfs list with bootstrap_yapps and Yapps in the the registry.
list/2 | Lists all registered Yapps.
remove/3 | Remove a Yapp from Yaws.

## Function Details

### add/3

`add(YappServer::pid(), SrvId::string(), AppName::atom()) -> ok | exit()`

Add a Yapp. Adds in the virtual server with the opaque property yapp_server_id = SrvID. The root URL will become "/" ++ atom_to_list(AppName) the Name of the application.

### add/4

`add(YappServer::pid(), SrvId::string(), YappUrl::string(), AppName::atom()) -> ok | exit()`

Add a Yapp. Adds in the virtual server with the opaque property yapp_server_id = SrvID. The YappUrl is the root path to the Yapp and the AppName is the Name of the application.

### init_yapps/1

`init_yapps(YappServer::pid()) -> ok | exit()`

Iinitalizes the Yaws Sconfs list with bootstrap_yapps and Yapps in the the registry. The default name for YappServer is the atom yapp_handler.

### list/2

`list(YappServer::pid(), YawsServerId::SrvId) -> Yapps | exit()`

- `SrvID = string() | all`
- `Yapps = {URL, AppName} | undefined`
- `URL = string()`
- `AppName = atom()`

Lists all registered Yapps.

### remove/3

`remove(YappServer::pid(), SrvId::string(), YappUrlOrName::string()) -> ok | exit()`

- `YappUrlOrName = string() | atom()`

Remove a Yapp from Yaws. Removes in the virtual server with yapp_server_id = SrvID. The YappUrlOrName is either the root path to the Yapp or the name of it.

Generated by EDoc