const express = require("express")
const cors = require("cors")
require("dotenv").config()

const userRoutesneedRefactor = require("./routes/user.routes")
const dealRoutes = require("./routes/deal.routes")
const authRoutes = require("./routes/auth.routes")
const dealVoteRoutes = require("./routes/vote.routes")
const commentRoutes = require("./routes/comment.routes")
const accountSettingsRoutes = require("./routes/accountSettings.routes")
const userRoutes = require("./routes/user.routes")
const sellerRoutes = require("./routes/seller.routes")
const voteRoutes=require("./routes/vote.routes")
const app = express()

app.use(cors())
app.use(express.json())
app.use(express.urlencoded({ extended: true }))

app.use("/api/users", userRoutesneedRefactor)
app.use("/api/deals", dealRoutes)
app.use("/api/auth", authRoutes)
app.use("/api/deal-votes", dealVoteRoutes)
app.use("/api/comments", commentRoutes)
app.use("/api/account", accountSettingsRoutes)
app.use("/api/user", userRoutes)
app.use("/api/seller", sellerRoutes)
app.use("/api/vote", voteRoutes)

app.listen(3000, () => console.log("Server running on http://localhost:3000"))
