require("dotenv").config();

const express = require("express");

const cors = require("cors");

const connectDB = require("./config/db");

const frontendRoutes = require("./routes/frontendRoutes");
const careerRoutes = require("./routes/careerRoutes");

connectDB();

const app = express();

app.use(cors());

app.use(express.json());

app.use("/api/admin", require("./routes/adminRoutes"));

app.use("/uploads", express.static("uploads"));

app.use("/api/categories", require("./routes/categoryRoutes"));

app.use("/api/products", require("./routes/productRoutes"));

app.use("/api/marble-spaces", require("./routes/marbleSpaceRoutes"));

app.use("/api/dashboard", require("./routes/dashboardRoutes"));


app.use("/api/career", careerRoutes);



app.use("/api/frontend", frontendRoutes);



app.get("/", (req, res) => {
  res.send("API Running");
});

app.listen(process.env.PORT, () => {
  console.log("Server Running");
});
