Skip to content

Commit

Permalink
Use service-auth as primary app
Browse files Browse the repository at this point in the history
  • Loading branch information
csuvajit committed Sep 30, 2023
1 parent 2fa42c7 commit 793587a
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aws-ecr-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
service: [service-app, service-capital, service-clans, service-wars]
service: [service-auth, service-capital, service-clans, service-wars]

runs-on: buildjet-4vcpu-ubuntu-2204-arm

Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": { "source.organizeImports": "explicit" },
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.insertSpaces": true,
Expand Down
12 changes: 0 additions & 12 deletions apps/service-app/src/app.controller.ts

This file was deleted.

12 changes: 12 additions & 0 deletions apps/service-auth/src/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { AuthService } from './auth.service';

@Controller()
export class AuthController {
constructor(private readonly authService: AuthService) {}

@Get()
getHello(): string {
return this.authService.getHello();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { RedisModule } from '@app/redis';
import { RestModule } from '@app/rest';
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';

@Module({
imports: [ConfigModule.forRoot({ isGlobal: true }), MongodbModule, RedisModule, RestModule],
controllers: [AppController],
providers: [AppService],
controllers: [AuthController],
providers: [AuthService],
})
export class AppModule {}
export class AuthModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common';
import { Db } from 'mongodb';

@Injectable()
export class AppService {
export class AuthService {
constructor(
@Inject(Tokens.MONGODB) private readonly db: Db,
@Inject(Tokens.REDIS) private readonly redis: RedisClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { AuthModule } from './auth.module';

async function bootstrap() {
const app = await NestFactory.create(AppModule);
const app = await NestFactory.create(AuthModule);
const logger = new Logger('NestApplication');

const port = process.env.PORT || 8081;
await app.listen(port);

logger.log(`Service-App: http://localhost:${port}`);
logger.log(`Service-Auth: http://localhost:${port}`);
}
bootstrap();
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import request from 'supertest';
import { AppModule } from '../src/app.module';
import { AuthModule } from '../src/auth.module';

describe('AppController (e2e)', () => {
describe('AuthController (e2e)', () => {
let app: INestApplication;

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
imports: [AuthModule],
}).compile();

app = moduleFixture.createNestApplication();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"declaration": false,
"outDir": "../../dist/apps/service-app"
"outDir": "../../dist/apps/service-auth"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: '3.6'

services:
service-app:
image: 432159388664.dkr.ecr.us-east-1.amazonaws.com/service-app:latest
container_name: service-app
service-auth:
image: 432159388664.dkr.ecr.us-east-1.amazonaws.com/service-auth:latest
container_name: service-auth
restart: always
# build:
# context: .
Expand Down
16 changes: 8 additions & 8 deletions nest-cli.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "apps/service-app/src",
"sourceRoot": "apps/service-auth/src",
"compilerOptions": {
"deleteOutDir": true,
"webpack": true,
"tsConfigPath": "apps/service-app/tsconfig.app.json"
"tsConfigPath": "apps/service-auth/tsconfig.app.json"
},
"generateOptions": {
"spec": false,
"flat": true
},
"monorepo": true,
"root": "apps/service-app",
"root": "apps/service-auth",
"projects": {
"service-app": {
"service-auth": {
"type": "application",
"root": "apps/service-app",
"root": "apps/service-auth",
"entryFile": "main",
"sourceRoot": "apps/service-app/src",
"sourceRoot": "apps/service-auth/src",
"compilerOptions": {
"tsConfigPath": "apps/service-app/tsconfig.app.json"
"tsConfigPath": "apps/service-auth/tsconfig.app.json"
}
},
"service-capital": {
Expand Down Expand Up @@ -123,4 +123,4 @@
}
}
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/apps/service-app/main",
"start:prod": "node dist/apps/service-auth/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./apps/service-app/test/jest-e2e.json"
"test:e2e": "jest --config ./apps/service-auth/test/jest-e2e.json"
},
"dependencies": {
"@elastic/elasticsearch": "^8.9.0",
Expand Down

0 comments on commit 793587a

Please sign in to comment.