Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Created a express based server with --server #33

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

twoixter
Copy link
Member

@twoixter twoixter commented Nov 26, 2022

I'm adding a express server activated with the --server CLI parameter:

$ node bin.js --server

This opens a server at default localhost:8080 with a POST /render route. This route accepts a MJML body or a JSON with the following structure:

{
    "mjml": "<mjml></mjml>"
}

The response contains the rendered HTML and optionally an error array:

{
    "result": {
        "errors": [],
        "html": "<!doctype html>\n    <html xmlns[...]"
    }
}

To change default localhost:8080 you can use the --port and --host parameters:

$ node bin.js --server --host 127.0.0.1 --port 9000

The reason for this change is that I'm testing a new method to call the MJML parsed based on HTTP requests instead of calling the node binary in order to avoid slow cool starts.

@twoixter twoixter requested a review from oscarotero November 26, 2022 00:33
@twoixter twoixter added the enhancement New feature or request label Nov 26, 2022
@twoixter twoixter marked this pull request as draft November 26, 2022 01:15
@twoixter
Copy link
Member Author

@oscarotero Marked as Draft because it's still missing the feature to merge tokens

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant