Download spectrum/shared/middlewares/thread-param.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 396 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/middlewares/thread-param.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/shared/middlewares/thread-param.js
-
curl -L -o thread-param.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/middlewares/thread-param.js
396 Bytes
| // Redirect any route ?thread=<id> or ?t=<id> to /thread/<id> | |
| const threadParamRedirect = (req, res, next) => { | |
| const threadId = req.query.thread || req.query.t; | |
| if (threadId) { | |
| if (req.query.m) { | |
| res.redirect(`/thread/${threadId}?m=${req.query.m}`); | |
| } else { | |
| res.redirect(`/thread/${threadId}`); | |
| } | |
| } else { | |
| next(); | |
| } | |
| }; | |
| export default threadParamRedirect; | |