config.js 715 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const path = require('path')
  2. const resolve = filePath => path.resolve(__dirname, filePath)
  3. const ports = {
  4. appPort: 5555,
  5. wsPort: 5556
  6. }
  7. const routerOptions = {
  8. prefix: '/api'
  9. }
  10. const lruOptions = {
  11. max: 50, // 最多缓存50个
  12. maxAge: 1000 * 60 * 60 * 1 // 缓存1小时
  13. }
  14. const watchFileOptions = {
  15. interval: 60 * 10e2 // 轮询时间间隔
  16. }
  17. const dataPath = resolve('./data/data.txt')
  18. const reviewDataPath = resolve('./data/reviewData.txt')
  19. // 转换成绝对路径会出现访问 404
  20. const staticPath = '../dist'
  21. const filePath = {
  22. dataPath,
  23. reviewDataPath,
  24. staticPath
  25. }
  26. const config = {
  27. ports,
  28. routerOptions,
  29. lruOptions,
  30. watchFileOptions,
  31. filePath
  32. }
  33. module.exports = config