const express = require("express");
const cors = require("cors")
const user = require("./routes/userRoutes")
const car = require("./routes/carRoutes")
const service = require("./routes/serviceRoutes")
const payment = require("./routes/paymentRoutes")
const record = require("./routes/serviceRecord")
const report = require("./routes/reportroute")
const connectDB = require("./config/db");
require('dotenv').config();
const app = express();

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

app.use("/api/users", user)
app.use("/api/cars", car)
app.use("/api/services", service)
app.use("/api/payments", payment)
app.use("/api/records", record)
app.use('/api/report', report)
connectDB();

const port = process.env.PORT;

app.listen(port, ()=>{
  console.log(`Server running http://localhost:${port}`);
})
