Next.js Discord

Discord Forum

App router with external API

Unanswered
British Shorthair posted this in #help-forum
Open in Discord
British ShorthairOP
Hey 👋

I'm working on ironing out the kinks in a project I'm working on in regards to data-fetching (with server components) and external APIs.

We will have a Next.js app hosted on Vercel and a HTTP API hosted somewhere else. This means that we won't be able to simply call revalidate.. on the API server (on a mutation) to revalidate some data.

How would you recommend handling external queries and mutations with the app router?

Things I've thought of:
1. Have an API route who the API server can post to to revalidate 🥴 🥴 🥴
2. "use client" everything, ditch server components, and use client-side data-fetching for most things

cc @Blanc de Hotot

0 Replies