Download next.js/test/e2e/app-dir/app-static/pages/api/revalidate.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 285 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/app-static/pages/api/revalidate.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/app-static/pages/api/revalidate.js
-
curl -L -o revalidate.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/app-static/pages/api/revalidate.js
285 Bytes
| export default async function handler(req, res) { | |
| try { | |
| await res.revalidate(req.query.path) | |
| return res.json({ revalidated: true, now: Date.now() }) | |
| } catch (err) { | |
| console.error('Failed to revalidate', req.query, err) | |
| return res.json({ revalidated: false }) | |
| } | |
| } | |