reserve

custom handler

🔝 REserve documentation

Enables custom handlers.

{
  custom: async (request, response) => response.setHeader('X-Server', 'REserve')
}

Example of embedded mapping with the custom handler

{
  custom: './xserver.js'
}

Example of mapping with the custom handler

module.exports = async (request, response) => response.('X-Server', 'REserve')

Corresponding xserver.js file

{
  custom: () => [
    '<html><title>Not found</title></html>',
    {
      statusCode :404
    }
  ]
}

Example of custom mapping sending back a response (new to version 2.1.0)

{
  custom: [
    '<html><title>Not found</title></html>',
    {
      statusCode :404
    }
  ]
}

Example of custom mapping sending back a response (new to version 2.2.0)

Features

The custom property can be:

When custom is a function:

[!IMPORTANT] Only if the function’s length is 0or greater than 2

[!CAUTION] It overwrites any existing member with the same name