Skip to content

Commit

Permalink
chore: database schema and typeorm setup
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCodeGhinux committed Jul 21, 2024
1 parent ca32af4 commit 3d093b5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/app.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import HealthController from './health.controller';

describe('Health Check Test', () => {
let healthController: HealthController;

beforeEach(() => {
healthController = new HealthController();
});

describe('Get Health endpoint', () => {
it('should return healthy endpoint', async () => {
const result = 'healthy endpoint';

expect(await healthController.health()).toBe(result);
});
});
});
3 changes: 2 additions & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LoggerModule } from 'nestjs-pino';
import { TypeOrmModule } from '@nestjs/typeorm';
import dataSource from './database/data-source';
import { SeedingModule } from './database/seeding/seeding.module';
import HealthController from './health.controller';

@Module({
providers: [
Expand Down Expand Up @@ -52,6 +53,6 @@ import { SeedingModule } from './database/seeding/seeding.module';
}),
SeedingModule,
],
controllers: [],
controllers: [HealthController],
})
export class AppModule {}
13 changes: 13 additions & 0 deletions src/health.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Controller, Get } from '@nestjs/common';

@Controller()
export default class HealthController {
@Get('/')
public home() {
return { status_code: 200, message: 'Welcome to NestJs Backend Endpoint ......' };
}
@Get('health')
public health() {
return 'healthy endpoint';
}
}

0 comments on commit 3d093b5

Please sign in to comment.