 import express from 'express'
import cors from 'cors'
import 'dotenv/config.js'
import { connectDB } from './db/connectDB.js'
import userRoutes from './routes/UserRoutes.js'
import supplierRoutes from './routes/SupplierRoutes.js'
import shipmentRoutes from './routes/ShipmentRoutes.js'
import deliveryRoutes from './routes/DeliveryRoutes.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/supplier", supplierRoutes);
app.use("/api/shipment", shipmentRoutes);
app.use("/api/delivery", deliveryRoutes);

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