Skip to content

Commit

Permalink
More life to debug example
Browse files Browse the repository at this point in the history
  • Loading branch information
alombarte committed Jun 25, 2018
1 parent 2ed1f76 commit fd357b8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion engine/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var (
<p>This page didn't set any parameters in the URL.</p>
{{ /Params }}
</div>
<h2>Extra data from config(<tt>Extra</tt>)</h2>
<h2>Extra data from config (<tt>Extra</tt>)</h2>
<div class="response">
{{ #Extra }}
<pre>{{ . }}</pre>
Expand Down
27 changes: 9 additions & 18 deletions examples/debugger/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,28 @@
"CacheTTL": "1s"
},
{
"name": "static",
"URLPattern": "/static",
"Template": "static",
"CacheTTL": "1s",
"extra": {
"metadata_title":"API2HTML static page debugger"
}
},
{
"name": "dynamic",
"URLPattern": "/dynamic/object/:post",
"name": "post",
"URLPattern": "/post/:post",
"BackendURLPattern": "https://jsonplaceholder.typicode.com/posts/:post",
"Template": "dynamic",
"Template": "post",
"CacheTTL": "1s",
"extra": {
"metadata_title":"API2HTML dynamic page debugger"
"metadata_title":"API2HTML post page debugger"
}
},
{
"name": "dynamic",
"URLPattern": "/dynamic/lists",
"name": "post",
"URLPattern": "/posts",
"BackendURLPattern": "https://jsonplaceholder.typicode.com/posts",
"Template": "dynamic",
"Template": "post",
"IsArray": true,
"CacheTTL": "1s",
"extra": {
"metadata_title":"API2HTML dynamic page debugger"
"metadata_title":"API2HTML post page debugger"
}
}
],
"templates": {"home":"home.mustache","static":"home.mustache","dynamic":"home.mustache"},
"templates": {"home":"home.mustache","post":"home.mustache"},
"extra":{
"lang": "en-US",
"metadata_title": "API2HTML debugger"
Expand Down
17 changes: 16 additions & 1 deletion examples/debugger/home.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@
</head>

<body>
<h1>Hi there!</h1>
<h1>Debug example</h1>
<p>This is a simple page that uses a single page and loads data from an external API so you can see how the debug template changes.</p>

<ul>
{{ #Array }}
<li><a href="/post/{{ id }}">{{ title }}</a></li>
{{ /Array }}
</ul>

{{ #Data }}
<h2>{{ title }}</h2>
<p>{{ body }}</p>

{{ /Data }}



{{ >api2html/debug }}
</body>

0 comments on commit fd357b8

Please sign in to comment.