#Understanding route handler

6 messages · Page 1 of 1 (latest)

ivory cave
#

Hi there, i have a route handler to get reveiws from external resources

then i use it in my client component like this

 const { data, error, isLoading } = useSWR("/api/reviews/get_reviews", fetcher);

when building my app i noticed that this route handler is built as a static page

○ /api/reviews/get_reviews

Does this mean that all fetch request that are happening inside of this route handler are cached on build and then never refreshed or what?

sand schoonerBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

neat peak
#

@ivory cave that means, that the code inside the route handler don't change. Static = no code change. Dynamic = Code change through dynamics parts like parts in the url or params or ...

#

Even if you have "no code change" you can still get different results. For example when you fetch a external api. The code inside your route handler stays everytime the same, but the results from your api can change

sand schoonerBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer