Rename source folders
All checks were successful
forgejo/Procyon/seedling/pipeline/head This commit looks good
All checks were successful
forgejo/Procyon/seedling/pipeline/head This commit looks good
This commit is contained in:
parent
2398a7c8c9
commit
da23b80647
23 changed files with 4 additions and 4 deletions
24
source/rest/src/app.module.ts
Normal file
24
source/rest/src/app.module.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
// @ts-nocheck
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
import { envs } from './config';
|
||||
import { HealthModule } from './common/health/health.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot({
|
||||
isGlobal: true,
|
||||
load: [envs],
|
||||
}),
|
||||
TypeOrmModule.forRoot({
|
||||
type: 'sqlite',
|
||||
database: `db.sqlite`,
|
||||
entities: [],
|
||||
logging: ['query'],
|
||||
}),
|
||||
HealthModule,
|
||||
],
|
||||
})
|
||||
export class AppModule {}
|
14
source/rest/src/common/health/health.controller.spec.ts
Normal file
14
source/rest/src/common/health/health.controller.spec.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
// @ts-nocheck
|
||||
import { HealthController } from './health.controller';
|
||||
|
||||
describe('AppController (e2e)', () => {
|
||||
let healthController: HealthController;
|
||||
|
||||
beforeEach(() => {
|
||||
healthController = new HealthController();
|
||||
});
|
||||
|
||||
it('should return OK response', async () => {
|
||||
expect(await healthController.status()).toEqual('OK');
|
||||
});
|
||||
});
|
21
source/rest/src/common/health/health.controller.ts
Normal file
21
source/rest/src/common/health/health.controller.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
// @ts-nocheck
|
||||
import { Controller, Get, Response } from '@nestjs/common';
|
||||
import { ApiResponse } from '@nestjs/swagger';
|
||||
|
||||
@Controller('health-check')
|
||||
export class HealthController {
|
||||
/**
|
||||
* Health check endpoint
|
||||
*/
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'API is online',
|
||||
schema: {
|
||||
default: 'OK',
|
||||
},
|
||||
})
|
||||
@Get()
|
||||
status() {
|
||||
return 'OK';
|
||||
}
|
||||
}
|
8
source/rest/src/common/health/health.module.ts
Normal file
8
source/rest/src/common/health/health.module.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
// @ts-nocheck
|
||||
import { Module } from '@nestjs/common';
|
||||
import { HealthController } from './health.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [HealthController],
|
||||
})
|
||||
export class HealthModule {}
|
3
source/rest/src/config.ts
Normal file
3
source/rest/src/config.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export const envs = () => {
|
||||
return {};
|
||||
};
|
28
source/rest/src/main.ts
Normal file
28
source/rest/src/main.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
// @ts-nocheck
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
// swagger
|
||||
SwaggerModule.setup(
|
||||
'api',
|
||||
app,
|
||||
SwaggerModule.createDocument(
|
||||
app,
|
||||
new DocumentBuilder()
|
||||
.setTitle('$(AppName) API')
|
||||
.setDescription('The $(AppName) API description.')
|
||||
.setVersion('0.1.0')
|
||||
.addServer('/api/v1')
|
||||
.build(),
|
||||
),
|
||||
);
|
||||
|
||||
app.setGlobalPrefix('/api/v1');
|
||||
|
||||
await app.listen(8080);
|
||||
}
|
||||
bootstrap();
|
Loading…
Add table
Add a link
Reference in a new issue