fix(stage-tamagotchi): should handle EADDRINUSE, bug of srvx, robust for server channel restart, injeca fix

This commit is contained in:
Neko Ayaka
2026-03-10 23:47:39 +08:00
parent e6ac3ff46e
commit a2da08f2ce
14 changed files with 432 additions and 652 deletions
+5 -9
View File
@@ -2,14 +2,10 @@
import { env } from 'node:process'
import { plugin as ws } from 'crossws/server'
import { serve } from 'h3'
import { createServer } from '../server'
import { app } from '..'
serve(app, {
// TODO: fix types
// @ts-expect-error - the .crossws property wasn't extended in types
plugins: [ws({ resolve: async req => (await app.fetch(req)).crossws })],
port: env.PORT ? Number(env.PORT) : 6121,
const server = createServer({
port: env.PORT ? Number.parseInt(env.PORT) : 6121,
})
server.start()