# Exhtml

[![Inline docs](](

> This project is under active developement and is unreliable at this moment. DO NOT use it in your production.

Exhtml is a library that handles HTML page serving.
There are some benifts to have a dynamic HTML page host rather than static server:

1. it's easy to deploy a small number of pages.
2. it's safer to make the HTML server pull content from backend storage than push contents to it.
3. you can add middlewares as you wish, such as performance monitoring, server-side procsessing, etc..

## Installation

If [available in Hex](, the package can be installed as:

  1. Add `exhtml` to your list of dependencies in `mix.exs`:

    def deps do
      [{:exhtml, "~> 0.1.0"}]

  2. Ensure `exhtml` is started before your application:

    def application do
      [applications: [:exhtml]]

  3. (optional) Add configuration into your project:

    use Mix.Config

    # `content_fetcher` can either be a module or a function.
    # `MyContentFetcher.fetch` accepts a key and returns content for the key.
    config :exhtml,

      # use a function in named module as a fetcher:
      # content_fetcher: &MyContentFetcher.fetch/1,

      # or use an anonymous function:
      content_fetcher: fn slug -> "#{slug} content on remote" end,

      # where to store contents on disk:
      data_dir: "/home/data/exhtml_contents"

## Usage

# update content.
# Notice: contents live in memory and automaticly persisted in disk.
Exhtml.update_content :my_page

# later, get content:
Exhtml.get_content :my_page
#=> "my_page content on remote"

[Online documents](

## License

MIT liccense

## Contributions

* [Pull requests]( are welcome.
* [Issues here](