import express from 'express'
import cors from 'cors'
import 'dotenv/config'
import { connectDB } from './db/connectDB.js';

import feesRoutes from './routes/FeesRoutes.js'
import paymentRoutes from './routes/PaymentRoutes.js'
import recordRoutes from './routes/RecordRoutes.js'
import studentRoutes from './routes/StudentRoutes.js'
import userRoutes from './routes/UserRoutes.js'


import "./models/Fees.js";
import "./models/Student.js";

const app = express();
const PORT = process.env.PORT || 5000
connectDB();

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

app.use("/api/fees", feesRoutes);
app.use("/api/payments", paymentRoutes);
app.use("/api/record", recordRoutes);
app.use("/api/student", studentRoutes);
app.use("/api/user", userRoutes);
 


app.listen (PORT, () => {
    console.log(`server is running on http://localhost ${PORT}`);
})