Spaces:
Configuration error
Configuration error
| const express = require('express'); | |
| const cors = require('cors'); | |
| const dotenv = require('dotenv'); | |
| const path = require('path'); | |
| const docRoutes = require('./routes/documents'); | |
| const searchRoutes = require('./routes/search'); | |
| dotenv.config(); | |
| const app = express(); | |
| const PORT = process.env.PORT || 3004; | |
| app.use(cors()); | |
| app.use(express.json({ limit: '10mb' })); | |
| app.use('/api/documents', docRoutes); | |
| app.use('/api/search', searchRoutes); | |
| app.get('/api/health', (req, res) => { | |
| res.json({ status: 'ok', service: 'smart-doc-search' }); | |
| }); | |
| app.use(express.static(path.join(__dirname, 'public'))); | |
| app.get('*', (req, res) => { | |
| res.sendFile(path.join(__dirname, 'public', 'index.html')); | |
| }); | |
| app.listen(PORT, () => { | |
| console.log(`Smart Document Search API running on port ${PORT}`); | |
| }); | |