import mongoose from "mongoose";
import express from "express";
import cookieParser from "cookie-parser";
import cors from "cors";
import { configDotenv } from "dotenv";
import connectDB from "./configs/db.js";
import authRouter from "./routes/auth.route.js";
configDotenv()

const app = express();
const port = process.env.PORT || 5000;

app.use(express.json());
app.use(cookieParser());
app.use(cors({
    origin: "http://localhost:5173",
    credentials: true
}))

app.use("/api/auth", authRouter)

app.listen(port, () => {
    console.log(`Server is running on port ${port}`)
    connectDB()
})