useEffect(() => { const fetchAnalysisData = async () => { console.log("Starting to fetch analysis data..."); const response = await fetch("/api/get-final-result"); try { if (!response.ok) { throw new Error("Failed to fetch analysis data"); }
It is the codes in app/analysis/page.tsx and from here it request the api to app/api/get-final-result/route.ts
But it could not find the path. It is giving 404 error. It is on local right now. I am not sure that why it could not find the file path. There is another api files in api folers, but another works well.
app |---analysis/page.tsx |---api |---get-final-result/route.ts --> It does not work when I call it from analysis/page.tsx |---saveFilePath/route.ts --> It does work when I call it from app/page.tsx |---page.tsx
next.js version is 14. Do I need to change the api directory?
Deployment URL or Custom Domain:Environment (local, preview, production):Project Framework:Build Settings: Framework Preset: Build Command (if not default): Output Directory (if not default): Install Command (if not default):Node/Runtime Version:Package Manager:Relevant Packages: