Skip to main content

App features

App features are settings that slightly modify app behavior.

Toggle app features

You can enable, disable and toggle different app features with LunaticServer methods app.enable(), app.disable() and app.toggle() respectively.

import { LunaticServer } from '@shelepuginivan/lunatic'

const app = new LunaticServer()

app.disable('x-powered-by') // disables X-Powered-By header which is set by default

List of app features:

If you are using TypeScript, you can import type ApplicationFeature:

import { ApplicationFeature } from '@shelepuginivan/lunatic'

Currently, these features are available:

  • 500-on-error - send 500 Internal Server Error status if error occurred during request handling. Enabled by default
  • auto-head-handler - automatically respond to HEAD requests with same headers, but without body and status code 204 No Content. Enabled by default
  • x-powered-by - set response header X-Powered-By: Lunatic. Enabled by default