Add transport-neutral routing and stream contracts
This commit is contained in:
+13
-2
@@ -1,5 +1,6 @@
|
||||
import { Config } from './services/config.ts';
|
||||
import { Database, MigrationService } from './services/storage/index.ts';
|
||||
import { ApplicationRouter } from './services/router.ts';
|
||||
import { Logger } from './utils/logger.ts';
|
||||
|
||||
/** Application composition root. */
|
||||
@@ -17,12 +18,22 @@ export class App {
|
||||
const migrations = new MigrationService(database, debug);
|
||||
await migrations.migrateToLatest();
|
||||
|
||||
return new App(database);
|
||||
const routes = [];
|
||||
|
||||
// Route loading is an explicit startup phase, not first-request work.
|
||||
// ApplicationRouter.create validates every path and rejects duplicates
|
||||
// before any client can connect.
|
||||
const router = await ApplicationRouter.create(routes);
|
||||
|
||||
return new App(database, router);
|
||||
}
|
||||
|
||||
private stopPromise: Promise<void> | undefined;
|
||||
|
||||
constructor(private readonly database: Database) {}
|
||||
constructor(
|
||||
private readonly database: Database,
|
||||
private readonly router: ApplicationRouter,
|
||||
) {}
|
||||
|
||||
async start(): Promise<void> {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user