Skip to content

Commit

Permalink
prepare for deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
masechkacat committed Apr 29, 2024
1 parent 34227f0 commit 8921438
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 9 deletions.
51 changes: 49 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^3.2.2",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/platform-socket.io": "^10.3.8",
"@nestjs/websockets": "^10.3.8",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"cors": "^2.8.5",
"mock-socket": "^9.3.1",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1"
Expand Down
3 changes: 2 additions & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { GameModule } from './game/game.module';
import { ConfigModule } from '@nestjs/config';

@Module({
imports: [GameModule],
imports: [GameModule, ConfigModule.forRoot()],
controllers: [AppController],
providers: [AppService],
})
Expand Down
7 changes: 1 addition & 6 deletions src/game/game.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ import { GameMessages } from './game.const';
*
* @MessageBody is a decorator that injects the client-sent data transferred within the message.
*/
@WebSocketGateway({
cors: {
origin: 'http://127.0.0.1:5500',
credentials: true,
},
})
@WebSocketGateway({ cors: true })
export class GameGateway implements OnGatewayConnection, OnGatewayDisconnect {
@WebSocketServer() server: Server;

Expand Down
7 changes: 7 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as cors from 'cors';

async function bootstrap() {
const app = await NestFactory.create(AppModule, { cors: true });
app.use(
cors({
origin: process.env.CORS_ORIGIN,
credentials: true,
}),
);
await app.listen(3000);
console.log(`Application is running on: ${await app.getUrl()}`);
}
Expand Down

0 comments on commit 8921438

Please sign in to comment.