sveltekit api fetch from frontend not work

i doing follow this video: https://www.youtube.com/watch?v=qlmDj7q2x0c&t=742s But work with deploy on vps, not with cf pages. in component import to +page.svelte i fetch like this: const checklink = async (id: number) => { try { const testLink = await fetch(/api/checkLink/${id}) return await testLink.json() } catch (error) { throw error } } In folder api/checkLink/[id]/+server.ts export const GET = async ({ params }) => { const checkLink = async (id: string) => { try { const testLink = await fetch(https://doaminlink.../${id}`) if (testLink.ok) { return https://domainlink/${id} } return https://linkb/${id} } catch (error) { throw error } } return new Response(JSON.stringify(await checkLink(params.id))); }`
Huntabyte
YouTube
SvelteKit API Routes & Endpoints
If you find my content useful and want to support the channel, consider contributing a coffee ☕: https://hbyt.us/coffee SvelteKit is a framework for building modern, high-performance, browser-based applications. It was developed by the team behind the popular Svelte framework and is powered by Svelte. Unlike other JavaScript frameworks, it does...
1 Reply
tymon
tymon5mo ago
no one had the same issue? No one help??