3 ms·
What? You can still use an api with server components.
by robertoandred 3y ago
What? You can still use an api with server components.
- wokwokwok 3y ago…have you used next? https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations https://nextjs.org/docs/app/building-your-application/data-f... Spoiler: you don’t get an api.
- deleted 3y ago[deleted]
- opes 3y agoFrom those same docs, it appears you can build an API with Route Handlers when using Server Components: https://nextjs.org/docs/app/building-your-application/routing/route-handlers https://nextjs.org/docs/app/building-your-application/routin...
- leerob 3y agoCorrect. It can also run during the build, so it can be used to dynamically generated .txt, .json, or any other files. Great when deploying a static export of Next.js and dumping on S3 or similar. https://nextjs.org/docs/app/building-your-application/deploying/static-exports https://nextjs.org/docs/app/building-your-application/deploy...
- robertoandred 3y agoDo you know what an api is?