Created
March 19, 2022 22:15
-
-
Save bramses/4453cd4e2618d1790819ff28b4de7356 to your computer and use it in GitHub Desktop.
SWR backend example forn next js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default async function handler(req, res) { | |
| try { | |
| const res = await longDataFetch(); | |
| return res.status(200).json(res); | |
| } catch (err) { | |
| return res.status(500).json({ error: err.message }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment