Spaces:
Paused
Paused
Download middleware/auth.js from oqz-labs/newnodejs2: direct link, hf CLI and curl.
- Browser
- Download file 222 Bytes
-
https://huggingface.co/spaces/oqz-labs/newnodejs2/resolve/main/middleware/auth.js
- Command line
-
hf download hf://spaces/oqz-labs/newnodejs2/middleware/auth.js
-
curl -L -o auth.js https://huggingface.co/spaces/oqz-labs/newnodejs2/resolve/main/middleware/auth.js
222 Bytes
| module.exports = function (req, res, next) { | |
| const token = req.headers["x-access-token"]; | |
| if (!token || token !== process.env.ACCESS_TKN) { | |
| return res.status(401).json({ error: "Unauthorized" }); | |
| } | |
| next(); | |
| }; |