import express from "express";
import "dotenv/config";
import cors from "cors";
import { connectDB } from "./db/connectDB.js";
import userRoutes from "./routes/userRoutes.js";
import serviceRoutes from "./routes/serviceRoutes.js";
import carRoutes from "./routes/carRoutes.js";
import serviceRecordRoutes from "./routes/serviceRecordRoutes.js";
import paymentRoutes from "./routes/paymentRoutes.js";
 
const app = express();
const PORT = process.env.PORT || 5000;
connectDB();
 
app.use(cors());
app.use(express.json());
 
app.use("/api/user", userRoutes);
app.use("/api/service", serviceRoutes);
app.use("/api/car", carRoutes);
app.use("/api/servicerecord", serviceRecordRoutes);
app.use("/api/payment", paymentRoutes);
 
app.listen(PORT, () => {
    console.log(`Server is running on http://localhost:${PORT}`);
});