Next.js Discord

Discord Forum

Next app router API method

Answered
Gharial posted this in #help-forum
Open in Discord
GharialOP
I am new in next js with past experience in reactjs, what is recommended approach to integrate API In next js as rtk query just for client side but for server side I need to integrate fetch i.e for API call
For that I have to manage integration for both fetch and rtk
Answered by B33fb0n3
You can create a normal route handler that can then be called from your server and also from your client: https://nextjs.org/docs/app/building-your-application/routing/route-handlers

Keep in mind to build reusable functions, as you don't want to fetch your own api routes serverside
View full answer

4 Replies

Answer
@Gharial solved?
GharialOP
Yes 👍