diff --git a/apps/server/src/apps/h5p-library-management.app.ts b/apps/server/src/apps/h5p-library-management.app.ts index 342d83c6481..10ef160e9c9 100644 --- a/apps/server/src/apps/h5p-library-management.app.ts +++ b/apps/server/src/apps/h5p-library-management.app.ts @@ -1,8 +1,6 @@ /* istanbul ignore file */ /* eslint-disable no-console */ import { NestFactory } from '@nestjs/core'; -import { ExpressAdapter } from '@nestjs/platform-express'; -import express from 'express'; // register source-map-support for debugging import { install as sourceMapInstall } from 'source-map-support'; @@ -10,39 +8,17 @@ import { install as sourceMapInstall } from 'source-map-support'; // application imports import { LegacyLogger } from '@src/core/logger'; import { H5PLibraryManagementModule } from '@src/modules/h5p-library-management/h5p-library-management.module'; -import { enableOpenApiDocs } from '@src/shared/controller/swagger'; +import { H5PLibraryManagementService } from '@src/modules/h5p-library-management/service/h5p-library-management.service'; async function bootstrap() { sourceMapInstall(); - // create the NestJS application on a seperate express instance - const nestExpress = express(); + const nestApp = await NestFactory.createApplicationContext(H5PLibraryManagementModule); - const nestExpressAdapter = new ExpressAdapter(nestExpress); - const nestApp = await NestFactory.create(H5PLibraryManagementModule, nestExpressAdapter); // WinstonLogger nestApp.useLogger(await nestApp.resolve(LegacyLogger)); - // customize nest app settings - nestApp.enableCors({ exposedHeaders: ['Content-Disposition'] }); - enableOpenApiDocs(nestApp, 'docs'); - - await nestApp.init(); - - // mount instances - const rootExpress = express(); - - const port = 4499; // TODO: request port - const basePath = '/api/v3'; - - // exposed alias mounts - rootExpress.use(basePath, nestExpress); - rootExpress.listen(port); - - console.log('##########################################'); - console.log(`### Start H5P Library Management Server ###`); - console.log(`### Port: ${port} ###`); - console.log(`### Base path: ${basePath} ###`); - console.log('##########################################'); + const manager = new H5PLibraryManagementService(); + manager.run(); } void bootstrap(); diff --git a/apps/server/src/modules/h5p-library-management/h5p-library-management.module.ts b/apps/server/src/modules/h5p-library-management/h5p-library-management.module.ts index 899f285fe61..bf73ad3dcf5 100644 --- a/apps/server/src/modules/h5p-library-management/h5p-library-management.module.ts +++ b/apps/server/src/modules/h5p-library-management/h5p-library-management.module.ts @@ -7,11 +7,10 @@ import { RabbitMQWrapperModule } from '@shared/infra/rabbitmq'; import { DB_PASSWORD, DB_URL, DB_USERNAME } from '@src/config'; import { CoreModule } from '@src/core'; import { Logger } from '@src/core/logger'; -import { AuthenticationModule } from '@src/modules/authentication/authentication.module'; -import { AuthorizationModule } from '@src/modules/authorization'; + +import { LibraryStorage } from '../h5p-editor/service'; import { UserModule } from '..'; -import { H5PLibraryManegementUc } from './uc/h5p-library-management.uc'; const defaultMikroOrmOptions: MikroOrmModuleSyncOptions = { findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => @@ -20,8 +19,6 @@ const defaultMikroOrmOptions: MikroOrmModuleSyncOptions = { }; const imports = [ - AuthenticationModule, - AuthorizationModule, CoreModule, UserModule, RabbitMQWrapperModule, @@ -36,9 +33,9 @@ const imports = [ }), ]; -const controllers = [H5PLibraryManegementUc]; +const controllers = []; -const providers = [Logger, H5PLibraryManegementUc]; +const providers = [Logger, LibraryStorage]; @Module({ imports, diff --git a/apps/server/src/modules/h5p-library-management/service/h5p-library-management.service.ts b/apps/server/src/modules/h5p-library-management/service/h5p-library-management.service.ts new file mode 100644 index 00000000000..a8e034fd349 --- /dev/null +++ b/apps/server/src/modules/h5p-library-management/service/h5p-library-management.service.ts @@ -0,0 +1,10 @@ +import { Injectable } from '@nestjs/common'; + +@Injectable() +export class H5PLibraryManagementService { + run() { + // for debugging only + // eslint-disable-next-line no-console + console.log('Hello from H5PLibraryManagementService'); + } +}