Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
cache indivisual user and post
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 31, 2021
1 parent 4409eba commit ed0ecee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/src/routes/api/post.js
Expand Up @@ -21,6 +21,7 @@ router.get('/posts/:postId', async (req, res) => {
throw new httpErrors.NotFound();
}

res.setHeader('Cache-Control', 'public, max-age=300, s-maxage=180')
return res.status(200).type('application/json').send(post);
});

Expand Down
1 change: 1 addition & 0 deletions server/src/routes/api/user.js
Expand Up @@ -45,6 +45,7 @@ router.get('/users/:username', async (req, res) => {
throw new httpErrors.NotFound();
}

res.setHeader('Cache-Control', 'public, max-age=300, s-maxage=180')
return res.status(200).type('application/json').send(user);
});

Expand Down

0 comments on commit ed0ecee

Please sign in to comment.