Next.js Discord

Discord Forum

handle fetching from external backend

Unanswered
Bosnian Coarse-haired Hound posted this in #help-forum
Open in Discord
Bosnian Coarse-haired HoundOP
Hey all, i'm curently working on a nextjs project with another developer.
Our API doesn't live in the nextjs app, or in the same repo even, and we currently just write fetch calls to it.

The problem is that we don't have a centralized way of handling common logic, like checking for access token, and we end up copy-pasting a lot of logic.

How do you handle and scale up requests in a nextjs project? should we use a library? should we write some kind of centralized API function?

1 Reply