cleanup, automatically reconnect servers

This commit is contained in:
marlon-erler
2024-07-08 18:02:08 +02:00
parent 4daa4fd3ad
commit 1d6a1d5667
3 changed files with 36 additions and 12 deletions
+9 -1
View File
@@ -1,6 +1,8 @@
import { PACKAGE_FILE, STATIC_DIR } from ".";
import Colors from "colors";
import Fs from "fs/promises";
import { PACKAGE_FILE } from ".";
import Path from "path";
import { WebSocketMessage } from "./websocket-handler";
// CONFIG
@@ -22,6 +24,12 @@ export async function getVersionNumber(): Promise<string> {
}
}
// SERVER
export function createFileResponse(requestPath: string): Response {
const fullPath = Path.join(STATIC_DIR, requestPath);
return new Response(Bun.file(fullPath));
}
// OUTPUT
async function writeToLogFile(message: string): Promise<void> {
await Fs.appendFile("logs", `${message}\n`);