text: const express = require("express");
  const db = require("../models");
  const { isAuthenticated } = require("../config/auth");
  
  const router = express.Router();
  
  // use isAuthenticated middleware to protect this route
  router.get("/api/user/:id", isAuthenticated, (req, res) => {
    db.User.findById(req.params.id)
      .then((data) => {
        if (data) {
          res.json(data);
        } else {
          res.status(404).send({ success: false, message: "No user found" });
        }
      })
      .catch((err) => res.status(400).send(err));
  });
  
  module.exports = router;
  