Download api/status.js from ilhamdev/quote-api: direct link, hf CLI and curl.
- Browser
- Download file 773 Bytes
-
https://huggingface.co/spaces/ilhamdev/quote-api/resolve/main/api/status.js
- Command line
-
hf download hf://spaces/ilhamdev/quote-api/api/status.js
-
curl -L -o status.js https://huggingface.co/spaces/ilhamdev/quote-api/resolve/main/api/status.js
773 Bytes
| /** | |
| * Vercel Serverless Function: /api/status | |
| * Health check proxied to Hugging Face backend | |
| */ | |
| export default async function handler(req, res) { | |
| res.setHeader('Access-Control-Allow-Origin', '*'); | |
| res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS'); | |
| res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With'); | |
| if (req.method === 'OPTIONS') { | |
| return res.status(204).end(); | |
| } | |
| try { | |
| const hfRes = await fetch('https://ilhamdev-quote-api.hf.space/status'); | |
| const text = await hfRes.text(); | |
| res.setHeader('Content-Type', 'application/json'); | |
| return res.status(hfRes.status).send(text); | |
| } catch (err) { | |
| return res.status(502).json({ status: false, message: 'Backend unreachable' }); | |
| } | |
| } | |