Files
supabase/apps/studio/middleware.ts
2024-11-11 14:27:17 +08:00

26 lines
701 B
TypeScript

import { IS_PLATFORM } from 'lib/constants'
import type { NextRequest } from 'next/server'
export const config = {
matcher: '/api/:function*',
}
// [Joshen] Return 404 for all next.js API endpoints EXCEPT the ones we use in hosted:
const HOSTED_SUPPORTED_API_URLS = [
'/ai/sql/suggest',
'/ai/sql/generate-v2',
'/ai/sql/title',
'/ai/sql/debug',
'/get-ip-address',
]
export function middleware(request: NextRequest) {
// const url = request.url
// if (IS_PLATFORM && !HOSTED_SUPPORTED_API_URLS.some((url) => request.url.endsWith(url))) {
// return Response.json(
// { success: false, message: 'Endpoint not supported on hosted' },
// { status: 404 }
// )
// }
}