@gluonjs/core


@gluonjs/core / src / disposeGluonApplicationForServer

Function: disposeGluonApplicationForServer()

disposeGluonApplicationForServer(app): Promise<void>

Releases providers and plugin resources owned by a server application.

Parameters

app

GluonApp

Returns

Promise<void>

Example

Release server-only application plugins, scopes, and lifecycle resources in a finally block after serialization:

ts
import {
  createApp,
  disposeGluonApplicationForServer,
  html,
  renderGluonApplicationForServer,
} from '@gluonjs/core';
import { renderToString } from '@gluonjs/ssr';

const app = createApp(() => html`<main>Server-owned shop</main>`);
try {
  const template = renderGluonApplicationForServer(app);
  console.log(await renderToString(template));
} finally {
  await disposeGluonApplicationForServer(app);
}