From 4169015794d6c520176dd336223751d7e3a900a1 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Wed, 6 Nov 2019 14:02:51 +0800 Subject: [PATCH] parameter 'dist' rename to 'from' --- server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 2336c0b..6aca153 100644 --- a/server.js +++ b/server.js @@ -39,7 +39,7 @@ try { .option('-H, --host ', `Host ip or domain name. Default to ${Config.host}`) .option('-P, --protocol ', `Web server protocol http|https|httpall|http2https. Default to ${Config.protocol}`) .option('-p, --port ', `Server port. Default to ${Config.port?Config.port:'80|443'}`) - .option('-d, --dist ', `Distribution folder to serve as webroot. Default to ${Config.dist}`) + .option('-f, --from ', `Distribution folder to serve as webroot. Default to ${Config.from}`) .option('--sslType ', `SSL provider type. Default to ${Config.sslType}`) .option('--sslCert ', `SSL certificate file. Default to ${Config.sslCert}`) .option('--sslKey ', `SSL private key file. Default to ${Config.sslKey}`) @@ -50,7 +50,7 @@ try { Config.host=commander.host || Config.host Config.protocol=commander.protocol || Config.protocol || 'http' Config.port=parseInt(commander.port) || parseInt(Config.port) || (Config.protocol==='http'?80:Config.protocol==='https'?443:undefined) // 端口默认为 http:80, https:443, httpall: 80|443 - Config.dist = commander.dist || Config.dist || 'dist' + Config.from = commander.from || Config.from || 'dist' Config.sslType = commander.sslType || Config.sslType Config.sslCert=commander.sslCert || Config.sslCert Config.sslKey=commander.sslKey || Config.sslKey @@ -95,7 +95,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.dist), {index: 'index.html'})) + server.use(require('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')