mirror of
https://github.com/docmost/docmost.git
synced 2025-11-12 23:42:37 +10:00
updates and fixes
* seo friendly urls * custom client serve-static module * database fixes * fix recent pages * other fixes
This commit is contained in:
@ -4,7 +4,7 @@ import {
|
||||
FastifyAdapter,
|
||||
NestFastifyApplication,
|
||||
} from '@nestjs/platform-fastify';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NotFoundException, ValidationPipe } from '@nestjs/common';
|
||||
import { TransformHttpResponseInterceptor } from './interceptors/http-response.interceptor';
|
||||
import fastifyMultipart from '@fastify/multipart';
|
||||
|
||||
@ -14,12 +14,29 @@ async function bootstrap() {
|
||||
new FastifyAdapter({
|
||||
ignoreTrailingSlash: true,
|
||||
ignoreDuplicateSlashes: true,
|
||||
} as any),
|
||||
}),
|
||||
);
|
||||
|
||||
app.setGlobalPrefix('api');
|
||||
|
||||
await app.register(fastifyMultipart as any);
|
||||
await app.register(fastifyMultipart);
|
||||
|
||||
app
|
||||
.getHttpAdapter()
|
||||
.getInstance()
|
||||
.addHook('preHandler', function (req, reply, done) {
|
||||
if (
|
||||
req.originalUrl.startsWith('/api') &&
|
||||
!req.originalUrl.startsWith('/api/auth/setup')
|
||||
) {
|
||||
if (!req.raw?.['workspaceId']) {
|
||||
throw new NotFoundException('Workspace not found');
|
||||
}
|
||||
done();
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
|
||||
Reference in New Issue
Block a user