Move websocket routes into a separate app

This is mostly so we don't have to do any wacky patching but it also
makes it so we don't have to keep checking if the request is a web
socket request every time we add middleware.
This commit is contained in:
Asher
2020-11-05 12:58:37 -06:00
parent 9e09c1f92b
commit 7b2752a62c
8 changed files with 134 additions and 145 deletions

View File

@ -102,9 +102,9 @@ const main = async (args: DefaultedArgs): Promise<void> => {
throw new Error("Please pass in a password via the config file or $PASSWORD")
}
const [app, server] = await createApp(args)
const [app, wsApp, server] = await createApp(args)
const serverAddress = ensureAddress(server)
await register(app, server, args)
await register(app, wsApp, server, args)
logger.info(`Using config file ${humanPath(args.config)}`)
logger.info(`HTTP server listening on ${serverAddress} ${args.link ? "(randomized by --link)" : ""}`)