Some of the problems you might see when the configuration of API2HTML is not the one expected..
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.
Solution
Fix the IsArray
value of the configuration. Use IsArray:true
if the expected response is an Array. If it is an Object, remove the setting.
Symptoms
The API2HTML server returns a 500 error for a request and logs messages like this one:
Error #01: no rendered defined
Diagnosis
Your configuration is not properly defining the name of the template
that matches the page
.
Solution
Configure a template
that matches the page
name.
Example:
"pages":[
{
"name": "home",
...
"templates": {"home":"home.mustache"}
...
Symptoms
The API2HTML server does not start and you are getting error messages like the following ones:
engine creation aborted: invalid character '\n' in string literal
engine creation aborted: invalid character '"' after object key:value pair
Diagnosis
Your configuration file is not a proper JSON.
Solution
Have you closed the quotes in the configuration file? Is a comma missing? Have you closed the quotes in the configuration file?
The best way to deal with this kind of errors is to check your configuration file with any JSON linter.
Symptoms
You saved your template file but you cannot see the changes applied in the web page.
Diagnosis
This is expected. Your templates are compiled at start up time and any content you have in the disk after this won’t be checked.
Solution
Restart the service or use the hot reload in development.
← Back to Debugging