Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 1.49 KB

File metadata and controls

42 lines (30 loc) · 1.49 KB

mjml-api

Build

Convert MJML to HTML.

Getting Started

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://127.0.0.1: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":[]
}