Browse Source

fix: duplicated gui middleware

pull/7651/head
mertmit 9 months ago
parent
commit
6e202027ac
  1. 2
      packages/nocodb/src/Noco.ts
  2. 3
      packages/nocodb/src/app.module.ts
  3. 2
      packages/nocodb/src/nocobuild.ts

2
packages/nocodb/src/Noco.ts

@ -2,7 +2,6 @@ import path from 'path';
import { NestFactory } from '@nestjs/core';
import clear from 'clear';
import * as express from 'express';
import NcToolGui from 'nc-lib-gui';
import { T } from 'nc-help';
import { v4 as uuidv4 } from 'uuid';
import dotenv from 'dotenv';
@ -126,7 +125,6 @@ export default class Noco {
await nestApp.init();
const dashboardPath = process.env.NC_DASHBOARD_URL ?? '/dashboard';
server.use(NcToolGui.expressMiddleware(dashboardPath));
server.use(express.static(path.join(__dirname, 'public')));
if (dashboardPath !== '/' && dashboardPath !== '') {

3
packages/nocodb/src/app.module.ts

@ -75,9 +75,10 @@ export const ceModuleConfig = {
export class AppModule {
// Global Middleware
configure(consumer: MiddlewareConsumer) {
const dashboardPath = process.env.NC_DASHBOARD_URL ?? '/dashboard';
consumer
.apply(GuiMiddleware)
.forRoutes({ path: '*', method: RequestMethod.GET })
.forRoutes({ path: `${dashboardPath}*`, method: RequestMethod.GET })
.apply(GlobalMiddleware)
.forRoutes({ path: '*', method: RequestMethod.ALL });
}

2
packages/nocodb/src/nocobuild.ts

@ -1,6 +1,5 @@
import { NestFactory } from '@nestjs/core';
import express from 'express';
import NcToolGui from 'nc-lib-gui';
import { AppModule } from '~/app.module';
export default async function (app) {
@ -9,7 +8,6 @@ export default async function (app) {
await nestApp.init();
const dashboardPath = process.env.NC_DASHBOARD_URL ?? '/dashboard';
app.use(NcToolGui.expressMiddleware(dashboardPath));
app.get('/', (_req, res) => res.redirect(dashboardPath));
app.use(nestApp.getHttpAdapter().getInstance());

Loading…
Cancel
Save