-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
h5p: library management app, module, service
- Loading branch information
Showing
3 changed files
with
18 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,24 @@ | ||
/* 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'; | ||
|
||
// 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
apps/server/src/modules/h5p-library-management/service/h5p-library-management.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
} | ||
} |