log to acces.log file
This commit is contained in:
parent
ff00dab464
commit
de33ee5f92
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user