Skip to content

Latest commit

 

History

History
62 lines (48 loc) · 2.25 KB

README.md

File metadata and controls

62 lines (48 loc) · 2.25 KB

Html Table

Html Table is a small API for generating HTML tables

Requirements

Docker

Usage

Start the services using Docker Compose:

docker-compose up --build

The web service will be available at http://0.0.0.0:9292.

You can use the following endpoints to create html:

POST /html_tables

You can also add attributes and styles to your table, headers, rows, and cells

body example:

{
  "table": {
    "class": "my-table",
    "style": "border: solid black",
    "width": "800px",
    "height": "500px",
    "border": "2",
    "cellpadding": "10",
    "header": {
      "style": "font-weight: bold; text-align: center; background-color: lightgray;",
      "class": "header-cell",
      "columns": ["Name", "Age", "Email"]
    },
    "rows": [
      {
        "class": "data-cell",
        "style": "background-color: lightgray;",
        "data": ["John Doe", "25", "[email protected]"]
      },
      {
        "class": "data-cell",
        "style": "background-color: lightblue;",
        "data": ["Jane Smith", "30", "[email protected]"]
      },
      {
        "class": "data-cell",
        "style": "background-color: lightgray;",
        "data": ["Bob Johnson", "41", "[email protected]"]
      }
    ]
  }
}

response format example:

{"data":"<table class='my-table' style='border: solid black' width='800px' height='500px' border='2' cellpadding='10'><thead class='header-cell' style='font-weight: bold; text-align: center; background-color: lightgray;'><tr><th>Name</th><th>Age</th><th>Email</th></tr></thead><tbody><tr class='data-cell' style='background-color: lightgray;'><td>John Doe</td><td>25</td><td>[email protected]</td></tr><tr class='data-cell' style='background-color: lightblue;'><td>Jane Smith</td><td>30</td><td>[email protected]</td></tr><tr class='data-cell' style='background-color: lightgray;'><td>Bob Johnson</td><td>41</td><td>[email protected]</td></tr></tbody></table>"}