Next.js Discord

Discord Forum

fetch external api

Unanswered
Torymid wasp posted this in #help-forum
Open in Discord
Torymid waspOP
i have a same issue with https://stackoverflow.com/questions/78547999/need-advice-on-next-js-14-and-external-api-fetch-logic
https://example/apiRoute became /apiRoute of the internal url
help
const response = await fetch('https://my-api.something/route', { //became requesting to localhost:3000/route
          headers: {
            'authorization': `Bearer ${apiKey}`,
            'Content-Type': 'application/json; charset=utf8'
          },
        });

im using static exports hence i cant use rewrites

0 Replies