Skip to content

Commit

Permalink
Merge pull request #262 from jonfairbanks/fix/update-dependencies
Browse files Browse the repository at this point in the history
More socket.io jazz
  • Loading branch information
jonfairbanks authored Oct 15, 2024
2 parents e4f8189 + 28f00fb commit 460c543
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import serverless from 'serverless-http';
import dotenv from 'dotenv';
import http from 'http';
import RateLimit from 'express-rate-limit';
import { Server } from 'socket.io';

import yoRoutes from './routes/yo';
import './models/yo';
Expand All @@ -14,15 +13,6 @@ dotenv.config();

mongoose.Promise = global.Promise;

// Extend Express type to include `io`
declare global {
namespace Express {
interface Application {
io?: Server<ClientToServerEvents, ServerToClientEvents, InterServerEvents, SocketData>;
}
}
}

// Connect to MongoDB
async function connectToDB() {
try {
Expand Down Expand Up @@ -87,11 +77,6 @@ interface SocketData {
age: number;
}

// Initialize Socket.io
const server = http.createServer(app);
const io = new Server<ClientToServerEvents, ServerToClientEvents, InterServerEvents, SocketData>();
app.io = io; // Assign io to the app

// Wrap the Express app with serverless-http for AWS Lambda
const serverlessApp = serverless(app);

Expand Down

0 comments on commit 460c543

Please sign in to comment.