You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
725 B
28 lines
725 B
import express, { json, urlencoded } from 'express';
|
|
import cors from 'cors';
|
|
import ndviRoutes from './routes/ndvi.js';
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
app.use(cors());
|
|
app.use(json({ limit: '50mb' }));
|
|
app.use(urlencoded({ extended: true, limit: '50mb' }));
|
|
|
|
app.use('/api/ndvi', ndviRoutes);
|
|
|
|
app.get('/api/health', (req, res) => {
|
|
res.json({ status: 'OK', message: 'Работаю!' });
|
|
});
|
|
|
|
app.use((error, req, res, next) => {
|
|
console.error('Ошибка:', error);
|
|
res.status(500).json({
|
|
error: 'Internal server error',
|
|
message: error.message
|
|
});
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Сервер работает на порту ${PORT}`);
|
|
}); |