Przeglądaj źródła

feat: 新增目录

zhangyuhan 1 rok temu
rodzic
commit
a40f502620
2 zmienionych plików z 5 dodań i 3 usunięć
  1. 3 2
      bin/config.js
  2. 2 1
      bin/server/router.js

+ 3 - 2
bin/config.js

@@ -4,10 +4,11 @@ const rootDir = path.resolve(__dirname, '../web/')
 const appRootDir = path.resolve('/nas/shareFile/pdf-html')
 
 const config = {
+  APP_ROOT: appRootDir,
   PATH_ROOT: rootDir,
   PATH_LOGS: path.join(rootDir, 'logs'),
-  PATH_FILES: path.join(rootDir, 'pdf-files'),
-  // PATH_FILES: path.join(appRootDir, 'pdf-files'),
+  // PATH_FILES: path.join(rootDir, 'pdf-files'),
+  PATH_FILES: path.join(appRootDir, 'pdf-files'),
   LISTEN_PORT: '8088',
   DOMAIN: ''
 }

+ 2 - 1
bin/server/router.js

@@ -1,4 +1,4 @@
-const { LISTEN_PORT, PATH_ROOT, DOMAIN } = require('../config')
+const { LISTEN_PORT, PATH_ROOT, DOMAIN, APP_ROOT } = require('../config')
 const Koa = require('koa')
 const StaticServer = require('koa-static')
 const Router = require('koa-router')
@@ -12,6 +12,7 @@ const errorHandle = require('./errorHandle')
 const app = new Koa()
 
 app.use(StaticServer(PATH_ROOT))
+app.use(StaticServer(APP_ROOT))
 
 app.use(logger.loggerMiddleware())
 app.use(miSend())