mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05:00
refactor(frontend-integration): inline-import http-proxy-middleware
If no dev-dependencies are installed, the unconditional import crashes the app. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
4f40366e91
commit
2ae8b0c44f
2 changed files with 5 additions and 4 deletions
|
@ -52,7 +52,7 @@ async function bootstrap(): Promise<void> {
|
|||
`Serving OpenAPI docs for private api under '/private/apidoc'`,
|
||||
'AppBootstrap',
|
||||
);
|
||||
setupFrontendProxy(app, logger);
|
||||
await setupFrontendProxy(app, logger);
|
||||
}
|
||||
|
||||
await setupSpecialGroups(app);
|
||||
|
|
|
@ -4,19 +4,20 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||
import { createProxyMiddleware } from 'http-proxy-middleware';
|
||||
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { useUnless } from './use-unless';
|
||||
|
||||
export function setupFrontendProxy(
|
||||
export async function setupFrontendProxy(
|
||||
app: NestExpressApplication,
|
||||
logger: ConsoleLoggerService,
|
||||
): void {
|
||||
): Promise<void> {
|
||||
logger.log(
|
||||
`Setting up proxy to frontend dev server on port 3001`,
|
||||
'setupFrontendProxy',
|
||||
);
|
||||
const createProxyMiddleware = (await import('http-proxy-middleware'))
|
||||
.createProxyMiddleware;
|
||||
const frontendProxy = createProxyMiddleware({
|
||||
logProvider: () => {
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue