Guides  ›  Response  ›  HTML ← PREV NEXT →

HTML

Return a string to send HTML. Escape values supplied by users with the helpers from @nodedk/page.

var { html, esc } = require('@nodedk/page')

module.exports = {
  paths: '/',
  handler: function (state) {
    var name = state.req.query.name || 'world'
    return html`<h1>Hello ${esc(name)}!</h1>`
  }
}

The server sends text/html; charset=utf-8.

Next: JSON →

Tools for business systems.