rlcube / src /middleware.ts
imwithye's picture
fix vars2
73c1ae2
raw
history blame contribute delete
393 Bytes
import { NextResponse } from 'next/server';
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8000';
export const config = {
matcher: '/api/solve',
};
export function middleware(req: Request) {
const url = new URL(req.url);
if (url.pathname === '/api/solve') {
return NextResponse.rewrite(`${API_BASE_URL}/solve`);
}
return NextResponse.next();
}