Skip to content

Commit

Permalink
change nuber-app to gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas Abbal committed Jun 19, 2024
1 parent 94455ce commit 420117e
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 92 deletions.
22 changes: 22 additions & 0 deletions apps/gateway/src/gateway.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { GatewayController } from './gateway.controller';
import { GatewayService } from './gateway.service';

describe('GatewayController', () => {
let gatewayController: GatewayController;

beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [GatewayController],
providers: [GatewayService],
}).compile();

gatewayController = app.get<GatewayController>(GatewayController);
});

describe('root', () => {
it('should return "Hello World!"', () => {
expect(gatewayController.getHello()).toBe('Hello World!');
});
});
});
12 changes: 12 additions & 0 deletions apps/gateway/src/gateway.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Controller, Get } from '@nestjs/common';
import { GatewayService } from './gateway.service';

@Controller()
export class GatewayController {
constructor(private readonly gatewayService: GatewayService) {}

@Get()
getHello(): string {
return this.gatewayService.getHello();
}
}
10 changes: 10 additions & 0 deletions apps/gateway/src/gateway.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { GatewayController } from './gateway.controller';
import { GatewayService } from './gateway.service';

@Module({
imports: [],
controllers: [GatewayController],
providers: [GatewayService],
})
export class GatewayModule {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {
export class GatewayService {
getHello(): string {
return 'Hello World!';
}
Expand Down
6 changes: 2 additions & 4 deletions apps/nuber-app/src/main.ts → apps/gateway/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { GatewayModule } from './gateway.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';



async function bootstrap() {
const app = await NestFactory.create(AppModule);
const app = await NestFactory.create(GatewayModule);

// Swagger configuration
const config = new DocumentBuilder()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
import { GatewayModule } from '../src/gateway.module';

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

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
imports: [GatewayModule],
}).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/nuber-app"
"outDir": "../../dist/apps/gateway"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
Expand Down
22 changes: 0 additions & 22 deletions apps/nuber-app/src/app.controller.spec.ts

This file was deleted.

51 changes: 0 additions & 51 deletions apps/nuber-app/src/app.module.ts

This file was deleted.

18 changes: 9 additions & 9 deletions nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
"monorepo": true,
"root": "apps/nuber-app",
"projects": {
"nuber-app": {
"type": "application",
"root": "apps/nuber-app",
"entryFile": "main",
"sourceRoot": "apps/nuber-app/src",
"compilerOptions": {
"tsConfigPath": "apps/nuber-app/tsconfig.app.json"
}
},
"user-service": {
"type": "application",
"root": "apps/user-service",
Expand Down Expand Up @@ -81,6 +72,15 @@
"compilerOptions": {
"tsConfigPath": "libs/database/tsconfig.lib.json"
}
},
"gateway": {
"type": "application",
"root": "apps/gateway",
"entryFile": "main",
"sourceRoot": "apps/gateway/src",
"compilerOptions": {
"tsConfigPath": "apps/gateway/tsconfig.app.json"
}
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@
"^@app/database(|/.*)$": "<rootDir>/libs/database/src/$1"
}
}
}
}

0 comments on commit 420117e

Please sign in to comment.