|
@@ -6,20 +6,9 @@ const bodyParser = require('koa-bodyparser')
|
|
|
const LRU = require('lru-cache')
|
|
|
const WebSocket = require('ws')
|
|
|
const koaStatic = require('koa-static')
|
|
|
+const { routerOptions, lruOptions, watchFileOptions, filePath } = require('./config')
|
|
|
|
|
|
-const routerOptions = {
|
|
|
- prefix: '/api'
|
|
|
-}
|
|
|
-const lruOptions = {
|
|
|
- max: 50,
|
|
|
- maxAge: 1000 * 60 * 60 * 24
|
|
|
-}
|
|
|
-const watchFileOptions = {
|
|
|
- interval: 60 * 10e2
|
|
|
-}
|
|
|
-const dataPath = './data/data.txt'
|
|
|
-const reviewDataPath = './data/reviewData.txt'
|
|
|
-const staticPath = './dist'
|
|
|
+const { dataPath, reviewDataPath, staticPath } = filePath
|
|
|
|
|
|
const router = new Router(routerOptions)
|
|
|
const cache = new LRU(lruOptions)
|