chore: migrate backend to monorepo apps and biome
This commit is contained in:
8
apps/notifications/src/main.ts
Normal file
8
apps/notifications/src/main.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { NotificationsModule } from './notifications.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(NotificationsModule);
|
||||
await app.listen(process.env.NOTIFICATIONS_PORT ?? 3003);
|
||||
}
|
||||
bootstrap();
|
||||
22
apps/notifications/src/notifications.controller.spec.ts
Normal file
22
apps/notifications/src/notifications.controller.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { NotificationsController } from './notifications.controller';
|
||||
import { NotificationsService } from './notifications.service';
|
||||
|
||||
describe('NotificationsController', () => {
|
||||
let notificationsController: NotificationsController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const app: TestingModule = await Test.createTestingModule({
|
||||
controllers: [NotificationsController],
|
||||
providers: [NotificationsService],
|
||||
}).compile();
|
||||
|
||||
notificationsController = app.get<NotificationsController>(NotificationsController);
|
||||
});
|
||||
|
||||
describe('root', () => {
|
||||
it('should return "Hello World!"', () => {
|
||||
expect(notificationsController.getHello()).toBe('Hello World!');
|
||||
});
|
||||
});
|
||||
});
|
||||
12
apps/notifications/src/notifications.controller.ts
Normal file
12
apps/notifications/src/notifications.controller.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { NotificationsService } from './notifications.service';
|
||||
|
||||
@Controller()
|
||||
export class NotificationsController {
|
||||
constructor(private readonly notificationsService: NotificationsService) {}
|
||||
|
||||
@Get()
|
||||
getHello(): string {
|
||||
return this.notificationsService.getHello();
|
||||
}
|
||||
}
|
||||
10
apps/notifications/src/notifications.module.ts
Normal file
10
apps/notifications/src/notifications.module.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { NotificationsController } from './notifications.controller';
|
||||
import { NotificationsService } from './notifications.service';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
controllers: [NotificationsController],
|
||||
providers: [NotificationsService],
|
||||
})
|
||||
export class NotificationsModule {}
|
||||
8
apps/notifications/src/notifications.service.ts
Normal file
8
apps/notifications/src/notifications.service.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class NotificationsService {
|
||||
getHello(): string {
|
||||
return 'Hello World!';
|
||||
}
|
||||
}
|
||||
21
apps/notifications/test/app.e2e-spec.ts
Normal file
21
apps/notifications/test/app.e2e-spec.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import * as request from 'supertest';
|
||||
import { NotificationsModule } from './../src/notifications.module';
|
||||
|
||||
describe('NotificationsController (e2e)', () => {
|
||||
let app: INestApplication;
|
||||
|
||||
beforeEach(async () => {
|
||||
const moduleFixture: TestingModule = await Test.createTestingModule({
|
||||
imports: [NotificationsModule],
|
||||
}).compile();
|
||||
|
||||
app = moduleFixture.createNestApplication();
|
||||
await app.init();
|
||||
});
|
||||
|
||||
it('/ (GET)', () => {
|
||||
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
|
||||
});
|
||||
});
|
||||
9
apps/notifications/test/jest-e2e.json
Normal file
9
apps/notifications/test/jest-e2e.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"moduleFileExtensions": ["js", "json", "ts"],
|
||||
"rootDir": ".",
|
||||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
}
|
||||
}
|
||||
9
apps/notifications/tsconfig.app.json
Normal file
9
apps/notifications/tsconfig.app.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"declaration": false,
|
||||
"outDir": "../../dist/apps/notifications"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user