ads-marketing/mail-service/src/index.js
2025-07-22 14:43:26 +05:00

27 lines
643 B
JavaScript

import dotenv from 'dotenv';
dotenv.config();
import express from 'express';
import { sequelize } from './models/index.js';
const app = express();
app.use(express.json());
app.get('/', (req, res) => {
res.send('Mail Service is running');
});
(async () => {
try {
await sequelize.authenticate();
await sequelize.sync({ alter: true });
console.log('Database connected and models synced');
} catch (err) {
console.error('Unable to connect to the database:', err);
process.exit(1);
}
})();
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Mail Service listening on port ${PORT}`);
});