Fetching from Route Handlers on in a server component
Unanswered
Egyptian Mau posted this in #help-forum
Egyptian MauOP
Is this possible? Something similar to the
fetch('/api/endpoint') syntax from the previous version of Next.js except for the App Routes Route Handler?11 Replies
are you asking how you would make api routes to then call from your pages?
api routes meaning route handlers as they are called in the app router
Egyptian MauOP
Yeah that's it
how can I call a fetch request to and api endpoint from my pages or within components
you can still use pages api route with app dir
but its not recommended though
better if you call the function directly
Egyptian MauOP
Yeah I thought the case would just be implementing the server side logic directly in the server component, just wanted to make 100% sure first