createSchemaRefresh
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
| Param | Type | Default | Description |
|---|---|---|---|
| baseUrl | string | The Drupal base URL. | |
| [options] | object | DruxtSchema options, such as endpoint and schema.filter. | |
| [settings] | object | Refresh settings. | |
| [settings.hold] | boolean | true | Hold 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()