import express from "express";
import { loginUser,socialLoginUser, registerUser,forgetPassword,resetPassword, verifyEmail, resendVerification } from "../utils/authController.js";

const router = express.Router()
console.log("Line 5 of authRoutes",process.env.JWT_SECRET)

// Middleware to prevent caching of auth responses
const noCacheMiddleware = (req, res, next) => {
  res.set({
    'Cache-Control': 'no-store, no-cache, must-revalidate, private',
    'Pragma': 'no-cache',
    'Expires': '0'
  });
  next();
};

// Apply no-cache to all auth routes
router.use(noCacheMiddleware);

router.post("/create-user", registerUser)
router.post("/login-user", loginUser)
router.post("/login-withSocial",socialLoginUser )
router.post("/forget-password", forgetPassword)
router.post("/reset-password/:token", resetPassword)
router.get("/verify-email/:token", verifyEmail)
router.post("/resend-verification", resendVerification)

export default router


