Skip to content

basalt / mailer/src / renderPreviewResponse

Function: renderPreviewResponse() ​

> renderPreviewResponse(previews, mailer, pathname, query?): PreviewResponse

Defined in: mailer/src/preview.ts:60

Pure request router for the preview UI. createMailPreviewServer is a thin node:http wrapper over this — keep the logic here so it stays testable.

  • / → the app shell (sidebar + preview pane)
  • /raw/<name>/html → the layout-wrapped HTML body (for the iframe)
  • /raw/<name>/text → the plaintext body

Parameters ​

previews ​

MailPreview&lt;unknown&gt;[]

mailer ​

Mailer

pathname ​

string

query? ​

URLSearchParams = ...

Returns ​

PreviewResponse

Released under the MIT License.