How should I use createRouteData
How to request the internal API must write the full URL such as http://localhost:3000/api/list
5 Replies
I dont know much, but maybe because this function is async
async ([slug, page]) => {
it expects return value to be a Promise.
but currently there is return (await response.json());
maybe try to just return json?
actually... is that response type not a Promise also? because you made await
there...
const response = await fetch
i don't think so。I write the request address as http://localhost:3000/api/list and no error will be reported. I want to know if I have to write all
ah ok so this code is from an example
btw you can check network tab in browser devtools
from my experience if you call a fetch with some absolute url but without specifying protocol and domain it should just grab it from the current address
the only thing that can change it is use of
base
tag in page headerGitHub
[Bug?]: Why must an absolute path be used to create routing data · ...
Duplicates I have searched the existing issues Latest version I have tested the latest version Current behavior 😯 export function routeData({ params, location }: RouteDataArgs) { return createServe...
wow