Skip to content

ViBiOh/mjml-api

Repository files navigation

mjml-api

Build

Convert MJML to HTML.

Getting Started

A Docker image is available for amd64, arm and arm64 platforms on Docker Hub: vibioh/mjml.

You can configure app by passing CLI args or environment variables (cf. Usage section).

You'll find a Kubernetes exemple in the infra/ folder, using my app chart

Usage

The application can be configured by passing CLI args described below or their equivalent as environment variable. CLI values take precedence over environments variables.

Be careful when using the CLI values, if someone list the processes on the system, they will appear in plain-text. Pass secrets by environment variables: it's less easily visible.

node dist/index.js --help
Options:
  --version      Show version number                                   [boolean]
  --port         Listening port                                  [default: 3000]
  --workerCount  Worker count for cluster mode                      [default: 1]
  --help         Show help                                             [boolean]

HTTP Usage

curl -H 'Content-type: application/json' http://localhost:3000 -d '{"mjml":"<mjml><mj-body></mj-body></mjml>"}'

{
  "html":"
    <!doctype html>
    <html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">
      HTML_EMAIL_CONTENT
    </html>
  ",
  "errors":[]
}

About

MJML Conversion API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •