Skip to content

Instantly share code, notes, and snippets.

@bramses
Created March 19, 2022 22:15
Show Gist options
  • Select an option

  • Save bramses/4453cd4e2618d1790819ff28b4de7356 to your computer and use it in GitHub Desktop.

Select an option

Save bramses/4453cd4e2618d1790819ff28b4de7356 to your computer and use it in GitHub Desktop.
SWR backend example forn next js
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