Guides  ›  Response  ›  Direct responses ← PREV NEXT →

Direct responses

Use the native response object when you need to write the response yourself.

module.exports = {
  paths: '/text',
  handler: function (state) {
    state.res.writeHead(200, { 'content-type': 'text/plain' })
    state.res.end('Hello world!')
    return null
  }
}

Finish the response yourself and return null to stop the route chain. The server will not send a second response.

Next: Request flow →

Tools for business systems.