From 8f9794afbfb67f5882b08aaabee56bc80501bd05 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sun, 24 Nov 2019 12:48:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9Avhost=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5=E9=87=8C=E7=94=A8?= =?UTF-8?q?=E5=88=B0=E4=BA=86=20express=EF=BC=8C=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E6=8F=90=E5=89=8D=E5=8D=95=E7=8B=AC=E5=AE=9A=E4=B9=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 6aca153..7ef7bd8 100644 --- a/server.js +++ b/server.js @@ -69,7 +69,8 @@ async function init(){ /*** 设置全局对象 ***/ (async function start(){ await init() - const server = require('express')() + const express=require('express') + const server = express() const greenlock = (wo.Config.sslType === 'greenlock') ? require('greenlock-express').create({ version: 'draft-11', @@ -95,7 +96,7 @@ async function init(){ /*** 设置全局对象 ***/ // express.static 找到了具体文件,就返回;找不到,就next() // 所以,如果 vhost匹配了域名,且static找到了文件,就结束了。如果 vhost 匹配了域名,但static找不到文件,就继续往下。 if (!wo.Config.vhosts) { - server.use(require('express').static(path.join(process.cwd(), wo.Config.from), {index: 'index.html'})) + server.use(express.static(path.join(process.cwd(), wo.Config.from), {index: 'index.html'})) // server.use(require('serve-favicon')(path.join(process.cwd(), 'public', 'favicon.ico'))) // uncomment after placing your favicon in /public }else { let vhost = require('vhost')