Download next.js/test/integration/api-body-parser/pages/api/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 250 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/integration/api-body-parser/pages/api/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/integration/api-body-parser/pages/api/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/integration/api-body-parser/pages/api/index.js
250 Bytes
| export default (req, res) => { | |
| if ( | |
| process.env.CUSTOM_SERVER && | |
| typeof req.fromCustomServer === 'undefined' | |
| ) { | |
| throw new Error('missing custom req field') | |
| } | |
| if (req.method === 'POST') { | |
| res.status(200).json(req.body) | |
| } | |
| } | |