Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit 17291e3

Browse files
We're trying again ig
1 parent b56f6a3 commit 17291e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/api/scores/route.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Score } from '@/app/models/Score';
55

66
// Ensure Node.js runtime (not Edge) so we can use Mongoose
77
export const runtime = 'nodejs';
8+
// Force dynamic to prevent aggressive caching
9+
export const dynamic = 'force-dynamic';
810

911
// Reuse a cached connection across hot reloads / lambda invocations to avoid creating many sockets.
1012
declare global {
@@ -27,6 +29,7 @@ async function connectToDatabase(uri: string) {
2729
// Handle POST request to save a score
2830
export async function POST(req: Request) {
2931
const DB_URI = process.env.MONGO_URI; // read at request time to avoid build-time inlining issues
32+
console.log('POST /api/scores - MONGO_URI present:', !!DB_URI, 'length:', DB_URI?.length || 0);
3033
if (!DB_URI) {
3134
return NextResponse.json({ error: 'Server not configured (MONGO_URI missing)' }, { status: 503 });
3235
}
@@ -51,6 +54,7 @@ export async function POST(req: Request) {
5154
// Handle GET request to fetch all scores
5255
export async function GET() {
5356
const DB_URI = process.env.MONGO_URI; // read at request time
57+
console.log('GET /api/scores - MONGO_URI present:', !!DB_URI, 'length:', DB_URI?.length || 0);
5458
if (!DB_URI) {
5559
return NextResponse.json({ error: 'Server not configured (MONGO_URI missing)' }, { status: 503 });
5660
}

0 commit comments

Comments
 (0)