Initial commit
This commit is contained in:
commit
b3a51a4115
10336 changed files with 2381973 additions and 0 deletions
46
backend/dist/index.js
vendored
Normal file
46
backend/dist/index.js
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.prisma = void 0;
|
||||
const express_1 = __importDefault(require("express"));
|
||||
const cors_1 = __importDefault(require("cors"));
|
||||
const http_1 = require("http");
|
||||
const socket_io_1 = require("socket.io");
|
||||
const client_1 = require("@prisma/client");
|
||||
const auth_js_1 = __importDefault(require("./routes/auth.js"));
|
||||
const games_js_1 = __importDefault(require("./routes/games.js"));
|
||||
const teams_js_1 = __importDefault(require("./routes/teams.js"));
|
||||
const legs_js_1 = __importDefault(require("./routes/legs.js"));
|
||||
const upload_js_1 = __importDefault(require("./routes/upload.js"));
|
||||
const index_js_1 = __importDefault(require("./socket/index.js"));
|
||||
const app = (0, express_1.default)();
|
||||
const httpServer = (0, http_1.createServer)(app);
|
||||
const io = new socket_io_1.Server(httpServer, {
|
||||
cors: {
|
||||
origin: ['http://localhost:5173', 'http://localhost:3000'],
|
||||
methods: ['GET', 'POST']
|
||||
}
|
||||
});
|
||||
exports.prisma = new client_1.PrismaClient();
|
||||
app.use((0, cors_1.default)());
|
||||
app.use(express_1.default.json());
|
||||
app.use('/uploads', express_1.default.static('uploads'));
|
||||
app.use('/api/auth', auth_js_1.default);
|
||||
app.use('/api/games', games_js_1.default);
|
||||
app.use('/api/teams', teams_js_1.default);
|
||||
app.use('/api/legs', legs_js_1.default);
|
||||
app.use('/api/upload', upload_js_1.default);
|
||||
app.get('/api/health', (req, res) => {
|
||||
res.json({ status: 'ok' });
|
||||
});
|
||||
(0, index_js_1.default)(io);
|
||||
const PORT = process.env.PORT || 3001;
|
||||
httpServer.listen(PORT, () => {
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
});
|
||||
process.on('SIGINT', async () => {
|
||||
await exports.prisma.$disconnect();
|
||||
process.exit();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue