All Projects → devopsfaith → Api2html

devopsfaith / Api2html

Licence: apache-2.0
Using the data from your API, generate the HTML on the fly! Server-side rendering of the mustache templates

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Api2html

Swagger Stats
API Observability. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices.
Stars: ✭ 559 (+476.29%)
Mutual labels:  api, microservices
Zato
ESB, SOA, REST, APIs and Cloud Integrations in Python
Stars: ✭ 889 (+816.49%)
Mutual labels:  api, microservices
Handlebars.net
A real .NET Handlebars engine
Stars: ✭ 723 (+645.36%)
Mutual labels:  template-engine, mustache
Goa
Design-based APIs and microservices in Go
Stars: ✭ 4,493 (+4531.96%)
Mutual labels:  api, microservices
Graphql Microservices
Showcasing a graphql microservice setup
Stars: ✭ 68 (-29.9%)
Mutual labels:  api, microservices
Apisix
The Cloud-Native API Gateway
Stars: ✭ 7,920 (+8064.95%)
Mutual labels:  api, microservices
Graphiti
Stylish Graph APIs
Stars: ✭ 783 (+707.22%)
Mutual labels:  api, microservices
Mikado
Mikado is the webs fastest template library for building user interfaces.
Stars: ✭ 323 (+232.99%)
Mutual labels:  template-engine, mustache
Falcon
The no-nonsense REST API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
Stars: ✭ 8,654 (+8821.65%)
Mutual labels:  api, microservices
Gravitee Gateway
Gravitee.io - API Management - OpenSource API Gateway
Stars: ✭ 1,123 (+1057.73%)
Mutual labels:  api, microservices
Go Api Boilerplate
Go Server/API boilerplate using best practices DDD CQRS ES gRPC
Stars: ✭ 373 (+284.54%)
Mutual labels:  api, microservices
Hydrogen
🎈 Hydrogen. Voted (by me) the world's lightest static-site generator built with TypeScript ❤ It uses 🔥 lit-html inspired templating for super duper performant template generation.
Stars: ✭ 80 (-17.53%)
Mutual labels:  api, template-engine
Thymeleaf Spring
Thymeleaf integration module for Spring
Stars: ✭ 349 (+259.79%)
Mutual labels:  server-side-rendering, template-engine
Grmustache.swift
Flexible Mustache templates for Swift
Stars: ✭ 538 (+454.64%)
Mutual labels:  template-engine, mustache
Microcks
Kubernetes native tool for mocking and testing API and micro-services
Stars: ✭ 325 (+235.05%)
Mutual labels:  api, microservices
Tyk
Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Stars: ✭ 6,968 (+7083.51%)
Mutual labels:  api, microservices
moustachu
Mustache templating for Nim
Stars: ✭ 58 (-40.21%)
Mutual labels:  template-engine, mustache
Laravel5 Jsonapi
Laravel 5 JSON API Transformer Package
Stars: ✭ 313 (+222.68%)
Mutual labels:  api, microservices
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+8600%)
Mutual labels:  api, microservices
Health Checks Api
Standardize the way services and applications expose their status in a distributed application
Stars: ✭ 78 (-19.59%)
Mutual labels:  api, microservices

api2html

Build Status Go Report Card Coverage Status GoDoc

On the fly HTML generator from API data

API2HTML is a web server that renders Mustache templates and injects them your API data. This allows you to build websites by just declaring the API sources and writing the template view.

How does it work?

To create pages that feed from a backend you just need to add in the configuration file the URL patterns the server will listen to. Let's imagine we want to offer URLs like /products/13-inches-laptops where the second part is a variable that will be sent to the API:

...
"pages":[
{
    "name": "products",
    "URLPattern": "/products/:category",
    "BackendURLPattern": "http://api.company.com/products/:category",
    "Template": "products_list",
    "CacheTTL": "3600s",
    "extra": {
        "promo":"Black Friday"
    }
},
...

The Template setting will look for the file tmpl/products_list.mustache and the response of the BackendURLPattern call will be injected in the variable data. An example of how you could use it:

<h1>Products for sale</h1>
<p>Take advantage of the {{extra.promo}}!</p>
<table>
    {{#data}}
        <tr>
            <td>{{name}}</td>
            <td>{{price}}</td>
        </tr>
    {{/data}}

    {{^data}}
       <tr>
            <td colspan="2">There are no products in this category</td>
        </tr>
    {{/data}}
</table>

You probably guessed it already, but in this scenario the backend would be returning a response like this:

// http://api.company.com/products/13-inches-laptops
{
    [
        { "name": "13-inch MacBook Air", "price": "$999.00" },
        { "name": "Lenovo ThinkPad 13", "price": "$752.00" },
        { "name": "Dell XPS13", "price": "$925.00" }
    ]
}

Install

When you install api2html for the first time you need to download the dependencies, automatically managed by dep. Install it with:

$ make prepare

Once all dependencies are installed just run:

$ make

Run

Once you have successfully compiled API2HTML in your platform the binary api2html will exist in the folder. Execute it as follows:

$ ./api2html -h
Template Render As A Service

Usage:
  api2html [command]

Available Commands:
  generate    Generate the final api2html templates.
  serve       Run the api2html server.

Use "api2html [command] --help" for more information about a command.

Run the engine

$ ./api2html run -h
Run the api2html server.

Usage:
  api2html serve [flags]

Aliases:
  serve, run, server, start

Examples:
api2html serve -d -c config.json -p 8080

Flags:
  -c, --config string   Path to the configuration filename (default "config.json")
  -d, --devel           Enable the devel
  -p, --port int        Listen port (default 8080)

Generator

The generator allows you to create multiple mustache files using templating. That's right create templates with templates!

$ ./api2html generate -h
Generate the final api2html templates.

Usage:
  api2html generate [flags]

Aliases:
  generate, create, new


Examples:
api2html generate -d -c config.json

Flags:
  -i, --iso string    (comma-separated) iso code of the site to create (default "*")
  -p, --path string   Base path for the generation (default ".")
  -r, --reg string    regex filtering the sources to move to the output folder (default "ignore")

Hot template reload

$ curl -X PUT -F "[email protected]/path/to/tmpl.mustache" -H "Content-Type: multipart/form-data" \
http://localhost:8080/template/<TEMPLATE_NAME>

Building and running with Docker

To build the project with Docker:

$ make docker

And run it as follows:

$ docker run -it --rm -p8080:8080 -v $PWD/config.json:/etc/api2html/config.json api2html -d -c /etc/api2html/config.json
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].