const express = require('express');
const router = express.Router();


router.get('/', (req, res) => {
  res.json({ message: 'Welcome to the API!' });
});

router.get('/test-db', async (req, res) => {
  try {
    const result = await mongoose.connection.db.admin().ping();
    res.json({ currentTime: result });
  } catch (err) {
    res.status(500).json({ error: 'Database query failed', details: err.message });
  }
});

module.exports = router;
