[% DEFAULT
    meths = ['POST', 'GET', 'PUT', 'DELETE'],
    urls = ['/=/model', '/=/model/Book', '/=/model/Book/author', '/=/model/Book/author/agentzh' ];
-%]
digraph api_comb {
    graph [K=0.8, center,
        label="The Internal Structure of the OpenResty Server",
        dpi=110.0, fontname="consolas"];
    compound=true;
    ranksep=1.25;
    splines=false;
    orientation="E";
    edge [color=red, dir=none];
    node [fillcolor="#f1e1f4", shape=box, style=filled, fontname="consolas"];

    subgraph cluster_url {
        graph [bgcolor="#ddddff", label="Backends", labeljust="l"];
        node [fillcolor=white];

    [%- i = 0; %]
    [%- FOREACH url = urls.reverse %]
        url_[% i %] [label="[%- url %]", width=1.2];
        [%- i = i + 1 %]
    [%- END %]
    };

    subgraph cluster_meth {
        graph [bgcolor="#ddffdd", label="HTTP method", labeljust="l"];
        node [fillcolor=white];

    [%- FOREACH meth = meths %]
        [% meth %] [width=1.1];
    [%- END %]
    };

    [%- i = 0; %]
    [%- FOREACH url = urls.reverse %]
        [%- FOREACH meth = meths.reverse %]
             [% meth %] -> url_[% i %]
        [%- END %]
        [%- i = i + 1 %]
    [%- END %]
}

