mirror of
https://github.com/docmost/docmost.git
synced 2025-11-19 23:21:09 +10:00
Server SPA from server
* add /api prefix
This commit is contained in:
@ -29,6 +29,7 @@
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.456.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.456.0",
|
||||
"@fastify/multipart": "^8.0.0",
|
||||
"@hocuspocus/server": "^2.8.1",
|
||||
"@hocuspocus/transformer": "^2.8.1",
|
||||
"@nestjs/common": "^10.2.10",
|
||||
@ -38,6 +39,7 @@
|
||||
"@nestjs/mapped-types": "^2.0.4",
|
||||
"@nestjs/platform-fastify": "^10.2.10",
|
||||
"@nestjs/platform-socket.io": "^10.2.10",
|
||||
"@nestjs/serve-static": "^4.0.0",
|
||||
"@nestjs/typeorm": "^10.0.1",
|
||||
"@nestjs/websockets": "^10.2.10",
|
||||
"bcrypt": "^5.1.1",
|
||||
@ -49,6 +51,8 @@
|
||||
"pg": "^8.11.3",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rxjs": "^7.8.1",
|
||||
"sanitize-filename-ts": "^1.0.2",
|
||||
"slugify": "^1.6.6",
|
||||
"socket.io": "^4.7.2",
|
||||
"typeorm": "^0.3.17",
|
||||
"uuid": "^9.0.1",
|
||||
|
||||
@ -6,6 +6,8 @@ import { EnvironmentModule } from './environment/environment.module';
|
||||
import { CollaborationModule } from './collaboration/collaboration.module';
|
||||
import { DatabaseModule } from './database/database.module';
|
||||
import { WsModule } from './ws/ws.module';
|
||||
import { ServeStaticModule } from '@nestjs/serve-static';
|
||||
import { join } from 'path';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@ -14,6 +16,9 @@ import { WsModule } from './ws/ws.module';
|
||||
DatabaseModule,
|
||||
CollaborationModule,
|
||||
WsModule,
|
||||
ServeStaticModule.forRoot({
|
||||
rootPath: join(__dirname, '..', '..', 'client/dist'),
|
||||
}),
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
|
||||
@ -6,6 +6,7 @@ import {
|
||||
} from '@nestjs/platform-fastify';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { TransformHttpResponseInterceptor } from './interceptors/http-response.interceptor';
|
||||
import fastifyMultipart from '@fastify/multipart';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create<NestFastifyApplication>(
|
||||
@ -13,9 +14,13 @@ async function bootstrap() {
|
||||
new FastifyAdapter({
|
||||
ignoreTrailingSlash: true,
|
||||
ignoreDuplicateSlashes: true,
|
||||
}),
|
||||
} as any),
|
||||
);
|
||||
|
||||
app.setGlobalPrefix('api');
|
||||
|
||||
await app.register(fastifyMultipart);
|
||||
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
@ -29,4 +34,5 @@ async function bootstrap() {
|
||||
|
||||
await app.listen(process.env.PORT || 3001);
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user