Spaces:
Sleeping
Sleeping
Download backend/src/app.ts from simhaa-hat/generated-bill: direct link, hf CLI and curl.
- Browser
- Download file 767 Bytes
-
https://huggingface.co/spaces/simhaa-hat/generated-bill/resolve/main/backend/src/app.ts
- Command line
-
hf download hf://spaces/simhaa-hat/generated-bill/backend/src/app.ts
-
curl -L -o app.ts https://huggingface.co/spaces/simhaa-hat/generated-bill/resolve/main/backend/src/app.ts
767 Bytes
| import express from 'express'; | |
| import cors from 'cors'; | |
| import helmet from 'helmet'; | |
| import router from './routes'; | |
| import { errorMiddleware } from './middleware/error.middleware'; | |
| export const app = express(); | |
| app.use(helmet()); | |
| app.use(cors({ | |
| origin: true, // Allow all origins | |
| credentials: true | |
| })); | |
| app.use(express.json({ limit: '50mb' }) as any); | |
| app.use(express.urlencoded({ extended: true, limit: '50mb' }) as any); | |
| app.get('/health', (req, res) => res.json({ status: 'ok', engine: 'node' })); | |
| app.use('/api/v1', router); | |
| // Handle 404 routes | |
| app.use((req, res) => { | |
| res.status(404).json({ | |
| error: 'Not Found', | |
| path: req.originalUrl, | |
| method: req.method | |
| }); | |
| }); | |
| app.use(errorMiddleware as any); | |
| export default app; | |