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')