Hi all I have the following routes
pages/upload.astro,
pages/eval.ts
my eval.ts code:
import type { APIRoute } from 'astro';
export const GET: APIRoute = () => {
return new Response(
JSON.stringify({
greeting: 'Hello'
})
)
}
my fech code in my upload.astro:
const response = fetch('/eval',{
method: 'POST',
body: form
}).then(r => r.json())
console.log(response)
when the function runs that invokes the fetch method my console errors with the following response
body
:
(...)
bodyUsed
:
false
headers
:
Headers {}
ok
:
false
redirected
:
false
status
:
404
statusText
:
"Not Found"
type
:
"basic"
url
:
"http://localhost:4321/eval"
[[Prototype]]
:
Response