-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.xml
167 lines (137 loc) · 13 KB
/
index.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>API2HTML | Convert raw API data into beautiful webpages</title>
<link>/</link>
<description>Recent content on API2HTML | Convert raw API data into beautiful webpages</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<lastBuildDate>Wed, 20 Jun 2018 20:25:08 +0100</lastBuildDate><atom:link href="/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Overview</title>
<link>/docs/overview/</link>
<pubDate>Sun, 04 Feb 2018 16:43:08 +0100</pubDate>
<guid>/docs/overview/</guid>
<description>How API2HTML works? To create a new site define in a configuration .json file all the pages you want to serve (URL patterns) along with its associated view (template) and external API call where the data is (backend). In a nutshell, you create a json file similar to this:
&quot;pages&quot;:[ { &quot;URLPattern&quot;: &quot;/posts/:post_id&quot;, &quot;BackendURLPattern&quot;: &quot;https://jsonplaceholder.typicode.com/posts/:post_id&quot;, &quot;Template&quot;: &quot;post&quot;, ... API2HTML will take it from here and will serve pages like /posts/23, calling the defined backend API and injecting the data in the post template.</description>
</item>
<item>
<title>Installation</title>
<link>/docs/getting-started/</link>
<pubDate>Sun, 04 Feb 2018 16:43:08 +0100</pubDate>
<guid>/docs/getting-started/</guid>
<description>Download The first thing you need to do is to download or clone the source code of API2HTML.
Download or cloneCompilation requirements API2HTML is a self-contained binary with no external dependencies. Nevertheless, in order to generate the binary you will need:
Go lang (install) make (your operating system usually comes with this) Installation Once you have the source code, you need to compile it from the terminal. Just cd the directory you have cloned or downloaded and execute:</description>
</item>
<item>
<title>Running the server</title>
<link>/docs/running-the-server/</link>
<pubDate>Mon, 12 Feb 2018 12:20:00 +0100</pubDate>
<guid>/docs/running-the-server/</guid>
<description>API2HTML needs a configuration file in json format with the definition of the service you want to start. As the configuration file declares what templates are loaded in every page, you will need to have these templates in a folder too. The easiest way to get started is using the blog example provided in the source code under examples/blog. Here you have all the files to run your first site.</description>
</item>
<item>
<title>Creating your first site</title>
<link>/docs/creating-your-first-site/</link>
<pubDate>Sun, 04 Feb 2018 16:43:08 +0100</pubDate>
<guid>/docs/creating-your-first-site/</guid>
<description>Before understanding all the options and capabilities of the tool let&rsquo;s have a quick look at the workflow involved in creating a new site. Let&rsquo;s keep using the blog example as the base to construct a new site:
1) Define the page route Decide what the pages that you want to serve and type the URL directly in the URLPattern field are. You can use any :variables you want here. These variables will be available for the API call</description>
</item>
<item>
<title>Configuration file</title>
<link>/docs/configuration-file/</link>
<pubDate>Thu, 08 Feb 2018 16:35:08 +0100</pubDate>
<guid>/docs/configuration-file/</guid>
<description>Let&rsquo;s start with an example and then let&rsquo;s decompose the keys:
{ &quot;robots&quot;: true, &quot;sitemap&quot;: true, &quot;static_txt_content&quot;: [ &quot;hello.txt&quot; ], &quot;pages&quot;:[ { &quot;name&quot;: &quot;post&quot;, &quot;URLPattern&quot;: &quot;/posts/:post&quot;, &quot;BackendURLPattern&quot;: &quot;https://jsonplaceholder.typicode.com/posts/:post&quot;, &quot;Template&quot;: &quot;post&quot;, &quot;Layout&quot;: &quot;main&quot;, &quot;CacheTTL&quot;: &quot;3600s&quot; }, { &quot;name&quot;: &quot;home&quot;, &quot;URLPattern&quot;: &quot;/&quot;, &quot;BackendURLPattern&quot;: &quot;https://jsonplaceholder.typicode.com/posts&quot;, &quot;Template&quot;: &quot;home&quot;, &quot;Layout&quot;: &quot;main&quot;, &quot;CacheTTL&quot;: &quot;3600s&quot;, &quot;IsArray&quot;: true, &quot;extra&quot;: {&quot;is_home&quot;:true } } ], &quot;templates&quot;: {&quot;home&quot;:&quot;home.mustache&quot;,&quot;post&quot;:&quot;post.mustache&quot;}, &quot;layouts&quot;: {&quot;main&quot;:&quot;main_layout.mustache&quot;}, &quot;extra&quot;:{ &quot;lang&quot;: &quot;en-US&quot;, &quot;copyright&quot;: &quot;© 2018 My Company&quot; }, &quot;public_folder&quot;: { &quot;path_to_folder&quot;: &quot;.</description>
</item>
<item>
<title>Templates</title>
<link>/docs/templates/</link>
<pubDate>Thu, 08 Feb 2018 16:35:08 +0100</pubDate>
<guid>/docs/templates/</guid>
<description>The templates are the essential part of API2HTML as they are the only thing you need to code to make your site. All the templates are expected to be mustache templates. In the examples we use the extension .mustache but it is up to you the extension you want to use (or none), even .html, as long as you declare the filename in the templates section.
Template vs Layout A template and a layout are in essence the same thing: HTML content that will be loaded in the page.</description>
</item>
<item>
<title>Customizing errors</title>
<link>/docs/customizing-errors/</link>
<pubDate>Sun, 04 Feb 2018 16:43:08 +0100</pubDate>
<guid>/docs/customizing-errors/</guid>
<description>When you start the server and the errors are not yet customized you will see the following messages in the console:
reading ./static/500 : open ./static/500: no such file or directory reading ./static/404 : open ./static/404: no such file or directory reading ./static/405 : open ./static/405: no such file or directory This message is just informing you that whenever an HTTP error 500, 404 or 405 is raised the user will just see a message in plain text, similar to this:</description>
</item>
<item>
<title>New Relic integration</title>
<link>/docs/new-relic-integration/</link>
<pubDate>Thu, 08 Feb 2018 16:35:08 +0100</pubDate>
<guid>/docs/new-relic-integration/</guid>
<description>The API2HTML integration with New Relic does all the heavy lifting for you. By setting your license key and the name of the application you will be able to see the activity in New Relic.
With the New Relic integration you can:
Follow the throughput, response times, and errors. See the memory usage, garbage collection, and CPU usage. Detect change of trends when introducing different backend calls. Adding New Relic Add the following code to your configuration.</description>
</item>
<item>
<title>Multi site generator</title>
<link>/docs/generator/</link>
<pubDate>Thu, 08 Feb 2018 16:35:08 +0100</pubDate>
<guid>/docs/generator/</guid>
<description>What is the generator? Mustache is a logic-less templates, meaning that you have a limited set of options to display your content (and also a limited possibility to have errors). Usually template engines have responsibilities like dealing with translations or site configuration that have nothing related with the rendered template itself.
If you wanted to inject translations in a mustache template you would need to inject as part of the data the translations used in the page.</description>
</item>
<item>
<title>Generating multiple sites</title>
<link>/docs/generating-multiple-sites/</link>
<pubDate>Thu, 08 Feb 2018 16:35:08 +0100</pubDate>
<guid>/docs/generating-multiple-sites/</guid>
<description>Directory structure The generator needs to have a known folder structure in order to operate properly. Let&rsquo;s see a typical directory structure the generator knows to use:
your_project/ ├── config │ ├── ca-ES │ │ ├── config.ini │ │ └── routes.ini │ └── global │ ├── config.ini │ └── routes.ini ├── i18n │ ├── ca-ES.ini │ ├── en-US.ini │ └── zh-CN.ini └── sources ├── ca-ES │ └── static │ ├── 1234567890.</description>
</item>
<item>
<title>Running the generator</title>
<link>/docs/running-the-generator/</link>
<pubDate>Thu, 08 Feb 2018 16:35:08 +0100</pubDate>
<guid>/docs/running-the-generator/</guid>
<description>To use the generator, the first thing you need to have is the folder structure expected by the generator.
You can see the usage of the command passing the help flag:
$ api2html generate -h Generate the final api2html templates. Usage: api2html generate [flags] Aliases: generate, create, new Examples: api2html generate -i en_US -r partial Flags: -h, --help help for generate -i, --iso string (comma-separated) iso code of the site to create (default &quot;*&quot;) -p, --path string Base path for the generation (default &quot;/Users/artomb/git/go/src/github.</description>
</item>
<item>
<title>Mustache templates</title>
<link>/docs/mustache/</link>
<pubDate>Thu, 08 Feb 2018 16:35:08 +0100</pubDate>
<guid>/docs/mustache/</guid>
<description>If you are not familiar with Mustache, we recommend you to start reading the super simple Mustache&rsquo;s syntax and build templates. Here is a basic example:
template.mustache
&lt;h1&gt;{{header}}&lt;/h1&gt; {{#bug}} {{/bug}} {{#items}} {{#first}} &lt;li&gt;&lt;strong&gt;{{name}}&lt;/strong&gt;&lt;/li&gt; {{/first}} {{#link}} &lt;li&gt;&lt;a href=&quot;{{url}}&quot;&gt;{{name}}&lt;/a&gt;&lt;/li&gt; {{/link}} {{/items}} {{#empty}} &lt;p&gt;The list is empty.&lt;/p&gt; {{/empty}} With the data
{ &quot;header&quot;: &quot;Colors&quot;, &quot;items&quot;: [ {&quot;name&quot;: &quot;red&quot;, &quot;first&quot;: true, &quot;url&quot;: &quot;#Red&quot;}, {&quot;name&quot;: &quot;green&quot;, &quot;link&quot;: true, &quot;url&quot;: &quot;#Green&quot;}, {&quot;name&quot;: &quot;blue&quot;, &quot;link&quot;: true, &quot;url&quot;: &quot;#Blue&quot;} ], &quot;empty&quot;: false } Produces the following HTML when rendered:</description>
</item>
<item>
<title>Hot reload</title>
<link>/docs/hot-reload/</link>
<pubDate>Wed, 20 Jun 2018 20:25:08 +0100</pubDate>
<guid>/docs/hot-reload/</guid>
<description>As API2HTML loads all the templates in-memory during start-up time, changing the content of a template in the disk has no effect in the server. This means that whenever you change the content of a template you need to inform the server that this happened, or restart the server instead.
While we are in development it is very convenient to have an automated system that applies the changes in the server for us.</description>
</item>
<item>
<title>Debugging</title>
<link>/docs/debugging/</link>
<pubDate>Wed, 20 Jun 2018 20:25:08 +0100</pubDate>
<guid>/docs/debugging/</guid>
<description>In addition to see what is going on in the API you are getting the data from, there is a couple of things you can do to have a healthy debugging session.
Add the debug template API2HTML comes with an internal template that you can reference in any of your templates to see the debug. Only if the server has been started with the -d flag you will be able to see it.</description>
</item>
<item>
<title>Common problems</title>
<link>/docs/common-problems/</link>
<pubDate>Sun, 04 Feb 2018 16:43:08 +0100</pubDate>
<guid>/docs/common-problems/</guid>
<description>The server returns a 500 error Cannot unmarshal Symptoms
The API2HTML server returns a 500 error for a request and logs messages like these ones:
Error #01: json: cannot unmarshal object into Go value of type []map[string]interface {} Error #01: json: cannot unmarshal array into Go value of type map[string]interface {} Diagnosis
Your configuration is not properly defining the expected type of result it should get from the backend.</description>
</item>
</channel>
</rss>