const express = require("express");
const router = express.Router();
const {
  getProjects,
  createProject,
  deleteProject,
  users,
} = require("../controllers/projects");
const authMiddleware = require("../middleware/authMiddleware");

router.use(authMiddleware);

router.get("/", getProjects);

router.post("/", (req, res, next) => {
  console.log("POST /api/projects route hit");
  console.log("Request body:", req.body);
  console.log("Request headers:", req.headers);
  next();
}, createProject);

router.delete("/", deleteProject);

router.post("/users", users);

module.exports = router;
