Skip to content

Drupal Content Entity schema generator for Druxt with support for View and Form displays.

createSchemaRefresh

View source on GitHub

createSchemaRefresh ⇒ Object

Schema refresh for any Node server.

Returns a Connect handler for /_druxt/schema, the schema getter it uses, and a clear for when Drupal's configuration changes. Generation uses the given access without the API proxy, as the build does.

Kind: global constant

ParamTypeDefaultDescription
baseUrlstringThe Drupal base URL.
[options]objectDruxtSchema options, such as endpoint and schema.filter.
[settings]objectRefresh settings.
[settings.hold]booleantrueHold schemas until a clear. Off, each call regenerates.

Example

const schemas = createSchemaRefresh('https://example.com')
// Serve GET /_druxt/schema/<id>, with the path after /_druxt/schema as req.url.
schemas.handler(req, res)
// Where the server handles Drupal's purge.
schemas.clear()