diff --git a/src/index.ts b/src/index.ts index fd30777..3c447cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import cors from "cors"; import { generateKey } from "./key_factory"; import { MatchMaker } from "./matcmaker"; import { CommonMancalaGame, MancalaGame } from "mancala.js"; +import fs from "fs"; import { channel_game_move, channel_leave_game, @@ -20,6 +21,11 @@ import { GameMove } from "./models/GameMove"; const app = express(); app.use(cors()); +app.use( + morgan("common", { + stream: fs.createWriteStream("./access.log", { flags: "a" }), + }) +); app.use(morgan("dev")); const server = http.createServer(app); @@ -80,7 +86,6 @@ rtmt.listenMessage(channel_game_move, (userKey: string, message: Object) => { } } catch (err: any) { console.log(err); - deleteGame(game); rtmt.sendMessage(game.player1Id, channel_on_game_crashed, err); rtmt.sendMessage(game.player2Id, channel_on_game_crashed, err); }