How is fetched data in Next.js API routes stored?

This page summarizes the projects mentioned and recommended in the original post on /r/nextjs

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • leerob.io

    ✨ My portfolio built with Next.js, Tailwind, and Vercel.

  • I'm not sure if this we meant the same thing here, but I was referring to the caching headers that you implement within an API route you created, example with setHeader used in an API route. I genuinely thought that these headers were telling your servers, in my case Vercel's servers, to cache the fetched data on the server every time the fetch() runs. This way no need to store the latest fetched data in a database, but those are still cached and, therefore, immediately available when you want to retrieve (via fetch/axios or SWR/RQ) that data on the client (via fetch/axios or SWR/RQ) because it was already fetched on the server and cached on the server. If the "The fetch() implementation inside your API route does not do anything with those caching headers." What are they for? This means that using an API route is pointless if you don't store your data in a database? Every time you fetch() your API route on the client fetch('../api/user/'), the fetch() implementation inside your API route will have to make its requests from scratch fetch('https://example.com/some-external-endpoint') ? If this is true, there is no point of using an API route as it doesn't reduce the amount of work and waiting time on the client. You can make your life easier by directly fetching the external endpoint on the client...

  • SWR

    React Hooks for Data Fetching

  • There is nothing on the server that causes the API route to rerun. In Lee’s examples, he is using the SWR JavaScript library on the client to manage caching and requerying of the API.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts