@waylis/core / AppServer
Class: AppServer
Defined in: server/server.ts:60
Main application server.
This class encapsulates the initialization and lifecycle management of the server, including database, file storage, configuration, and logging.
Constructors
Constructor
new AppServer(params?: AppServerParams): AppServer;Defined in: server/server.ts:80
Create a new application server instance.
Parameters
params?
Optional initialization parameters used to configure the server. If omitted, defaults will be applied.
Returns
AppServer
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
chatManager | protected | ChatManager | server/server.ts:65 |
config | protected | ServerConfig | server/server.ts:61 |
connections | protected | Map<string, ServerResponse<IncomingMessage>> | server/server.ts:72 |
database | protected | Database | server/server.ts:62 |
engine | protected | SceneEngine | server/server.ts:70 |
eventBus | protected | EventBusClass | server/server.ts:71 |
fileManager | protected | FileManager | server/server.ts:64 |
fileStorage | protected | FileStorage | server/server.ts:63 |
logger | protected | Logger | server/server.ts:68 |
messageManager | protected | MessageManager | server/server.ts:66 |
stepManager | protected | StepManager | server/server.ts:67 |
Methods
addScene()
addScene<Steps>(command: Command, scene: {
handler: (responses: SceneResponsesMap<Steps>) => Promise<
| SystemMessageBody
| SystemMessageBody[]>;
steps: [...Steps[]];
}): void;Defined in: server/server.ts:222
Add a new scene to the application.
A scene represents a sequence of steps that the engine will execute when the specified command is triggered.
Type Parameters
Steps
Steps extends readonly SceneStep<any, any>[]
A tuple of SceneStep definitions representing the ordered steps of the scene.
Parameters
command
The command that will trigger this scene.
scene
The actual scene.
handler
(responses: SceneResponsesMap<Steps>) => Promise< | SystemMessageBody | SystemMessageBody[]>
steps
[...Steps[]]
Returns
void
getFileManager()
getFileManager(): Promise<FileManager>;Defined in: server/server.ts:237
Get the FileManager instance for managing files.
Returns
Promise<FileManager>
A promise that resolves to the FileManager instance.
start()
start(): Promise<Server<typeof IncomingMessage, typeof ServerResponse>>;Defined in: server/server.ts:182
Start the HTTP server.
Returns
Promise<Server<typeof IncomingMessage, typeof ServerResponse>>
A new instance of the HTTP server.