import express from 'express'
import cors from 'cors'
import 'dotenv/config.js'
import { connectDB } from './db/connectDB.js';
import ProductRoutes from './routes/ProductRoutes.js'
import WarehouseRoutes from './routes/WarehouseRoutes.js'
import StockTransactionRoutes from './routes/StockTransactionRoutes.js'
import UserRoutes from './routes/UserRoutes.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/warehouse", WarehouseRoutes);
app.use("/api/product", ProductRoutes);
app.use("/api/stockTransaction", StockTransactionRoutes);

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