Untitled

 avatar
unknown
plain_text
20 days ago
385 B
3
Indexable
// Get All Clients for the Logged-in User (Protected Route)
router.get('/', auth, async(req, res) => {
    try {
        const clients = await Client.findAll({
            where: { user_id: req.user.id } // Filter clients by the logged-in user's ID
        });
        res.json(clients);
    } catch (error) {
        res.status(500).json({ error: error.message });
    }
});
Editor is loading...
Leave a Comment