config.js 655 B

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