Initial Commit

This commit is contained in:
2026-05-11 13:36:12 +00:00
commit 036512d580
11 changed files with 2112 additions and 0 deletions

40
src/app.ts Normal file
View File

@@ -0,0 +1,40 @@
import { HTTPService } from './services/http-router';
import { InvitationsRoute } from './routes/invitations';
import { InvitationStore } from './services/invitation-store';
import { SSEBroadcaster } from './services/sse-broadcast';
export class App {
static async create() {
// Create the invitation store (this is a in-memory store for now)
const invitationStore = new InvitationStore();
// Create the SSE Broadcaster
const sseBroadcaster = new SSEBroadcaster();
// Create the Invitation route, passing in the invitation store and sse broadcaster
const invitationsRoute = new InvitationsRoute(invitationStore, sseBroadcaster);
// Create the HTTP service, passing in the invitation route
const http = new HTTPService([
invitationsRoute,
]);
// Create the app instance, passing in the HTTP service
return new App(http);
}
/**
* Create a new instance of App.
* @param http - The HTTP service instance.
*/
constructor(private readonly http: HTTPService) {}
async start() {
// Start the HTTP service
await this.http.start();
}
}
// Create the app instance and start it
const app = await App.create();
await app.start();