Skip to content

Commit 289e974

Browse files
committed
refactor(api): remove production check from list-schemas route and adjust schema directory path
1 parent cfc3843 commit 289e974

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

app/api/list-schemas/route.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ interface SchemaObject {
1111
}
1212

1313
export async function GET() {
14-
// This route should only be used in development
15-
if (process.env.NODE_ENV === "production") {
16-
return NextResponse.json(
17-
{ error: "Endpoint not available in production. Use static index.json." },
18-
{ status: 404 },
19-
);
20-
}
14+
// Remove the production check - allow the route to run in all environments
15+
// if (process.env.NODE_ENV === "production") {
16+
// return NextResponse.json(
17+
// { error: "Endpoint not available in production. Use static index.json." },
18+
// { status: 404 },
19+
// );
20+
// }
2121

2222
try {
23-
const files = await fs.readdir(SCHEMAS_DIR);
23+
// Adjust path for potentially different cwd() in Vercel - read directly from ./public relative to project root
24+
const schemasDirRelative = path.join("public", "api", "schemas"); // Path relative to project root
25+
const files = await fs.readdir(schemasDirRelative);
2426

2527
// Filter to only include JSON files and exclude Zone.Identifier files
2628
const schemaFiles = files.filter(

0 commit comments

Comments
 (0)