Skip to content

Commit 9d195a9

Browse files
committedNov 28, 2024
Update route.ts
1 parent bf03b86 commit 9d195a9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎src/app/api/stats/route.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import { NextResponse } from 'next/server';
22
import { redis } from '@/lib/redis';
33

4+
export const dynamic = 'force-dynamic';
5+
46
export async function GET() {
57
try {
6-
const totalRequests = await redis.get('total_requests') || 0;
7-
return NextResponse.json({ totalRequests });
8+
const totalRequests = await redis.get('total_requests');
9+
10+
return NextResponse.json({ totalRequests }, {
11+
headers: {
12+
'Cache-Control': 'no-store, no-cache, must-revalidate, proxy-revalidate',
13+
'Pragma': 'no-cache',
14+
'Expires': '0',
15+
}
16+
});
817
} catch (error) {
918
console.error('Error fetching stats:', error);
1019
return NextResponse.json({ totalRequests: 0 });

0 commit comments

Comments
 (0)
Please sign in to comment.