From df085e9616e8707ed95c54ea67fb2bed013d6138 Mon Sep 17 00:00:00 2001 From: zhl Date: Thu, 2 Mar 2023 15:59:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E6=9C=89=E5=9C=A8=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=89=8D=E5=8A=A0=E4=B8=8A=E8=B7=A8=E5=9F=9F?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api.server.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api.server.ts b/src/api.server.ts index 9e3dab0..13f6a5a 100644 --- a/src/api.server.ts +++ b/src/api.server.ts @@ -35,8 +35,9 @@ export class ApiServer { secret: config.api.token_secret, expiresIn: config.api.token_expiresIn, }) - - this.server.register(require('@fastify/cors'), {}) + if (process.env.NODE_ENV !== 'production') { + this.server.register(require('@fastify/cors'), {}) + } } private registerRouter() {