Rename source folders
All checks were successful
forgejo/Procyon/seedling/pipeline/head This commit looks good

This commit is contained in:
Roman Jaroš 2023-10-24 20:43:21 +02:00
parent 2398a7c8c9
commit da23b80647
23 changed files with 4 additions and 4 deletions

View 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 {}

View 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');
});
});

View 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';
}
}

View file

@ -0,0 +1,8 @@
// @ts-nocheck
import { Module } from '@nestjs/common';
import { HealthController } from './health.controller';
@Module({
controllers: [HealthController],
})
export class HealthModule {}

View file

@ -0,0 +1,3 @@
export const envs = () => {
return {};
};

28
source/rest/src/main.ts Normal file
View 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();