Spaces:
Paused
Paused
Download src/app.js from imkrish/yatra-x-feedback: direct link, hf CLI and curl.
- Browser
- Download file 997 Bytes
-
https://huggingface.co/spaces/imkrish/yatra-x-feedback/resolve/main/src/app.js
- Command line
-
hf download hf://spaces/imkrish/yatra-x-feedback/src/app.js
-
curl -L -o app.js https://huggingface.co/spaces/imkrish/yatra-x-feedback/resolve/main/src/app.js
997 Bytes
| /** | |
| * Feedback Service - AI training data collection | |
| */ | |
| require('dotenv').config(); | |
| const express = require('express'); | |
| const { connectDB } = require('./db'); | |
| const feedbackRoutes = require('./routes/feedback.routes'); | |
| const { applySecurityMiddleware } = require('./middlewares/security'); | |
| const app = express(); | |
| const PORT = 7860; | |
| // Security middleware | |
| applySecurityMiddleware(app); | |
| app.use(express.json({ limit: '10kb' })); | |
| // Health check | |
| app.get('/health', async (req, res) => { | |
| res.json({ status: 'healthy', service: 'feedback-service', timestamp: new Date().toISOString() }); | |
| }); | |
| app.use('/api/v1/feedback', feedbackRoutes); | |
| // Error handler | |
| app.use((err, req, res, next) => { | |
| console.error('[Error]', err.message); | |
| res.status(err.status || 500).json({ error: err.message || 'Internal Server Error' }); | |
| }); | |
| async function start() { | |
| await connectDB(); | |
| app.listen(PORT, () => console.log(`🚀 Feedback Service running on port ${PORT}`)); | |
| } | |
| start(); | |
| module.exports = app; | |