From 5c49d59ec17b5dd06c1aef2d82158b9051c5a0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Fri, 19 Apr 2024 15:20:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/index.js b/server/index.js index f1c60fe55..16d7ad1a1 100644 --- a/server/index.js +++ b/server/index.js @@ -1,4 +1,5 @@ import express from "express"; +import path from "path"; import { getDomObj } from "./window" import { render } from "./render"; import { url, zoneUrl } from "../src/ssrUrl"; @@ -43,7 +44,8 @@ function excludePath(req, res, next) { app.use(excludePath); // 处理其他静态文件 -app.use(express.static('../../')); + +app.use(express.static(path.resolve(__dirname, '/home/pdl/forgeplus/public'))); // 匹配路径,匹配到的返回处理后的html,没匹配到转发到后端 app.get('*',async function (req,res) {