Skip to content

Commit

Permalink
sst設定変更
Browse files Browse the repository at this point in the history
  • Loading branch information
takecchi committed Dec 6, 2023
1 parent 3a439c4 commit a9f2b0c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/app/(menu)/(public)/[username]/posts/[postId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ type Params = { params: { username: string; postId: string } };

async function fetchPost(postId: string) {
try {
return await postsApi.getPost({ id: postId });
return await postsApi.getPost(
{ id: postId },
{
next: {
revalidate: 86400,
},
},
);
} catch {
return undefined;
}
Expand Down
9 changes: 5 additions & 4 deletions sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default {
if (stack.stage !== 'production') {
domain = `${stack.stage}.${domain}`;
}
const serverCachePolicy = new CachePolicy(stack, 'ServerCache', {
// CloudFrontでキャッシュさせたい場合に使用すること
const _serverCachePolicy = new CachePolicy(stack, 'ServerCache', {
minTtl: Duration.seconds(86400),
defaultTtl: Duration.seconds(86400),
headerBehavior: CacheHeaderBehavior.allowList(
Expand All @@ -41,9 +42,9 @@ export default {
NODE_ENV: stack.stage,
STAGE: stack.stage,
},
cdk: {
serverCachePolicy,
},
// cdk: {
// serverCachePolicy,
// },
});

stack.addOutputs({
Expand Down

0 comments on commit a9f2b0c

Please sign in to comment.