implemented endpoints for uploading and showing team pictures

This commit is contained in:
2024-04-19 21:39:13 +00:00
parent 829f621e55
commit bde37e4676
8 changed files with 908 additions and 6 deletions

View File

@@ -1,4 +1,6 @@
import { createServer } from "https";
import express from "express";
import { Server } from "socket.io";
import Game from "./game.js";
import { config } from "dotenv";
@@ -6,21 +8,25 @@ import { readFileSync } from "fs";
import { initAdminSocketHandler, secureAdminBroadcast } from "./admin_socket.js";
import { initTeamSocket, playersBroadcast } from "./team_socket.js";
import { PenaltyController } from "./penalty_controller.js";
import { initPhotoUpload } from "./photo.js";
//extract admin password from .env file
config();
const HOST = process.env.HOST;
const PORT = process.env.PORT;
export const app = express()
const httpsServer = createServer({
key: readFileSync(process.env.SSL_KEY, 'utf-8'),
cert: readFileSync(process.env.SSL_CERT, 'utf-8')
});
}, app);
httpsServer.listen(PORT, HOST, () => {
console.log(`Server running`);
});
//set cors to allow all origins
export const io = new Server(httpsServer, {
cors: {
@@ -47,4 +53,5 @@ penaltyController.init()
initAdminSocketHandler();
initTeamSocket();
initTeamSocket();
initPhotoUpload();