dp-table-renderer
Given json defining a table, capable of rendering a table in multiple formats
Getting started
| Environment variable |
Default |
Description |
| BIND_ADDR |
:23100 |
The host and port to bind to |
| CORS_ALLOWED_ORIGINS |
* |
The allowed origins for CORS requests |
| SHUTDOWN_TIMEOUT |
5s |
The graceful shutdown timeout (time.Duration format) |
Endpoints
| url |
Method |
Parameter values |
Description |
| /render/{render_type} |
POST |
render_type = html, csv, or xlsx |
Renders the (json) data provided in the post body as a table in the requested format |
| /parse/html |
POST |
|
Parses an html table and returns the json format suitable for sending to the /render endpoint |
See the swagger.yaml file for a full definition (use http://editor.swagger.io to make it easy to read),
and see the json files in the testdata directory for example requests.
/render/{render_type}
Merged cells can be specified using colspan and rowspan properties of cell_format elements.
Please note that the data array should include all cells (i.e. each row should contain the same number of cells), even if some of them have been merged. This is the same approach/format used by some javascript spreadsheet components such as Handsontable.
/parse/html
Please note that the is assumed to include include all cells (i.e. each row should contain the same number of cells), even if some of them have been hidden by merged cells. This is the same approach/format used by some javascript spreadsheet components such as Handsontable.
The response contains the html generated by /render/html as well as the json required to call that endpoint.
Healthchecking
Currently reported on endpoint /healthcheck. There are no other services consumed, so it will always return OK.
Contributing
See CONTRIBUTING for details.
License
Copyright © 2018, Office for National Statistics (https://www.ons.gov.uk)
Released under MIT license, see LICENSE for details.