|
|
@ -1,11 +1,17 @@ |
|
|
|
import { NestFactory } from '@nestjs/core'; |
|
|
|
import { NestFactory } from '@nestjs/core'; |
|
|
|
import express from 'express'; |
|
|
|
import express from 'express'; |
|
|
|
import { AppModule } from './app.module'; |
|
|
|
import { AppModule } from './app.module'; |
|
|
|
|
|
|
|
import NcToolGui from 'nc-lib-gui' |
|
|
|
|
|
|
|
|
|
|
|
export default async function (app = express()) { |
|
|
|
export default async function (app = express()) { |
|
|
|
const nestApp = await NestFactory.create(AppModule); |
|
|
|
const nestApp = await NestFactory.create(AppModule); |
|
|
|
await nestApp.init(); |
|
|
|
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()); |
|
|
|
app.use(nestApp.getHttpAdapter().getInstance()); |
|
|
|
|
|
|
|
|
|
|
|
return app; |
|
|
|
return app; |
|
|
|