import {syncDatabase, sequelize} from './sequelize.js';
import express from 'express';
import routes from './routes/index.js';

const app = express();

await sequelize.authenticate();

(async () => {
    try {
        await syncDatabase();
    } catch (error) {
        throw new Error('Ошибка в запуске приложения:', error);
    }
})();

app.use(express.json());
routes(app);

app.listen(3008, () => {
    console.log(`Приложение запущено на порту 3008`);
});