App
App is the application abstraction for the Esmx framework, providing a unified interface to manage application lifecycle, static resources, and SSR.
entry.node.ts
Type Definitions
App
middleware
- Type:
Middleware
Static resource handling middleware.
Development Environment:
- Handles static resource requests from source code
- Supports real-time compilation and hot reloading
- Uses
no-cachecaching strategy
Production Environment:
- Handles static resources after building
- Supports long-term caching for immutable files (
.final.xxx) - Optimized resource loading strategy
render
- Type:
(options?: RenderContextOptions) => Promise<RenderContext>
SSR function. Provides different implementations based on the runtime environment:
- Production environment (start): Loads the built server entry file (entry.server) to execute rendering
- Development environment (dev): Loads the server entry file from source code to execute rendering
build
- Type:
() => Promise<boolean>
Production environment build function. Used for resource bundling and optimization. Returns true upon successful build, false upon failure.
destroy
- Type:
() => Promise<boolean>
Resource cleanup function. Used to close the server, disconnect connections, etc. Returns true upon successful cleanup, false upon failure.