mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 11:22:19 +03:00
Ensured comment counts route doesn't load member (#19762)
refs https://linear.app/tryghost/issue/ENG-672/ The comment counts endpoint does not need member authentication. This saves us a bunch of db queries for each request
This commit is contained in:
parent
7f392c305b
commit
5fae212416
@ -11,15 +11,15 @@ module.exports = function apiRoutes() {
|
||||
const router = express.Router('comment api');
|
||||
router.use(bodyParser.json({limit: '50mb'}));
|
||||
|
||||
// Global handling for member session, ensures a member is logged in to the frontend
|
||||
router.use(membersService.middleware.loadMemberSession);
|
||||
|
||||
const countsCache = shared.middleware.cacheControl(
|
||||
'public',
|
||||
{maxAge: config.get('caching:commentsCountAPI:maxAge')}
|
||||
);
|
||||
router.get('/counts', countsCache, http(api.commentsMembers.counts));
|
||||
|
||||
// Authenticated Routes
|
||||
router.use(membersService.middleware.loadMemberSession);
|
||||
|
||||
router.get('/', http(api.commentsMembers.browse));
|
||||
router.get('/:id', http(api.commentsMembers.read));
|
||||
router.post('/', http(api.commentsMembers.add));
|
||||
|
Loading…
Reference in New Issue
Block a user