-
Notifications
You must be signed in to change notification settings - Fork 0
feat: move backend from demo-repository #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Domenic Dvojmoc <applecakes811@gmail.com>
|
Live and possibly alive @ https://pr-2.dev.sync.si/api/ |
|
this is ready for review? |
@MaticBabnik yes, this is more or less the foundation we will work around |
backend/src/WebSocketServer.ts
Outdated
| clientID: ClientID; | ||
| } | ||
|
|
||
| export const HANDLER_REGISTRY: Record<string, (ws: Bun.ServerWebSocket<WebSocketData>, message: any) => void> = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer that the REGISTRY would be constructed in one file (registry file imports all functions) rather than each handler registering itself in it's own file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is event/clientJoin a thing? This should probably run on open
| * Returns a shallow clone of all rooms | ||
| */ | ||
| export function allRooms(): Map<string, Room> { | ||
| return new Map<string, Room>(rooms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again not a fan of shallow clones.
If we really care about the map not being mutable we can just provide getRoom(x:string): Room and getRooms(): Iterator<Room> (maybe its Iterable not sure)
backend/src/index.ts
Outdated
| const app = new Elysia() | ||
| .get("/randomNumber", () => ({ result: ~~(Math.random() * 10000) })) | ||
| .get('/health', () => 'OK') | ||
| const statusler = "healthy"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who let @KickTheApple cook?
backend/src/index.ts
Outdated
| .get("/randomNumber", () => ({ result: ~~(Math.random() * 10000) })) | ||
| .get('/health', () => 'OK') | ||
| const statusler = "healthy"; | ||
| let uptimeler = Date.now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who let @KickTheApple cook pt2?
backend/src/index.ts
Outdated
| uptime: Math.floor((Date.now() - uptimeler) / 1000) | ||
| } | ||
| }) | ||
| .listen(3000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two servers?
I'm too cool to wait around for CI
Co-authored-by: Copilot <@Copilot>
No description provided.