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 saleRoutes from './routes/SaleRoutes.js'
import productRoutes from './routes/ProductRoutes.js'
import customerRoutes from './routes/CustomerRoutes.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/sale", saleRoutes);
app.use("/api/product", productRoutes);
app.use("/api/customer", customerRoutes);


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