blob: 3aea124505365987769059a8e5004512976266bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import * as express from 'express'
import { StatsManager } from '@server/lib/stat-manager'
import { ROUTE_CACHE_LIFETIME } from '../../../initializers/constants'
import { asyncMiddleware } from '../../../middlewares'
import { cacheRoute } from '../../../middlewares/cache'
const statsRouter = express.Router()
statsRouter.get('/stats',
asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.STATS)),
asyncMiddleware(getStats)
)
async function getStats (_req: express.Request, res: express.Response) {
const data = await StatsManager.Instance.getStats()
return res.json(data)
}
// ---------------------------------------------------------------------------
export {
statsRouter
}
|