zhengl / compo

A library for page composition pattern in microservice architecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compo

A library for page composition pattern in microservice architecture

Usage

compo accepts a html string(template) and resolves with composite content from endpoints specified by data attributs

compo(template)
//=> Promise

template

<div>
  <div data-compo-url="http://test-url1" data-compo-selector="h1"></div>
  <div data-compo-url="http://test-url2" data-compo-selector="h1"></div>
</div>

Endpoint 1

<h1>Hello URL1</h1>

Endpoint 2

<h1>Hello URL2</h1>

Result

<div>
  <h1>Hello URL1</h1>
  <h1>Hello URL2</h1>
</div>

About

A library for page composition pattern in microservice architecture

License:MIT License


Languages

Language:JavaScript 100.0%