No description
Find a file
2025-03-11 08:31:34 +01:00
.gitignore feat: Implements MJML.io-compatible API 2025-03-11 08:31:34 +01:00
LICENSE feat: Implements MJML.io-compatible API 2025-03-11 08:31:34 +01:00
package-lock.json feat: Implements MJML.io-compatible API 2025-03-11 08:31:34 +01:00
package.json feat: Implements MJML.io-compatible API 2025-03-11 08:31:34 +01:00
README.md feat: Implements MJML.io-compatible API 2025-03-11 08:31:34 +01:00
server.js feat: Implements MJML.io-compatible API 2025-03-11 08:31:34 +01:00

mjnml - The minimal MJML parser API

This is an Express API server that parses MJML templates and returns the HTML output.

Installation

From Repo

git clone https://git.private.coffee/PrivateCoffee/mjnml.git
cd mjnml
npm install

From NPM

npm install mjnml-api

Usage

npm start

Use the PORT environment variable to specify the port the server should listen on.

Endpoints

POST /v1/render

Request

{
  "mjml": "<mjml><mj-body><mj-section><mj-column><mj-text>Hello, World!</mj-text></mj-column></mj-section></mj-body></mjml>"
}

Response

{
  "errors": [],
  "html": "<!doctype html>\n<html lang=\"und\" dir=\"auto\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">[...]</html>\n  ",
  "mjml": "<mjml><mj-body><mj-section><mj-column><mj-text>Hello, World!</mj-text></mj-column></mj-section></mj-body></mjml>",
  "mjml_version": "4.15.3"
}

Error Response

{
  "message": "No MJML content provided",
  "request_id": "cb053063-c8ae-444e-8596-8a90cce9c9c4",
  "started_at": "2025-03-10T18:17:35.119Z"
}

GET /v1/health

Response

{ "status": "OK", "message": "mjnml MJML API is running" }

License

This project is licensed under the MIT License - see the LICENSE file for details.