const express = require('express'); const router = express.Router(); const fs = require('fs'); const path = require('path'); // GET /api/templates/default - Get the default template router.get('/default', (req, res) => { try { const templatePath = path.join(__dirname, '../templates/default.md'); if (!fs.existsSync(templatePath)) { return res.status(404).json({ success: false, error: 'Default template not found' }); } const templateContent = fs.readFileSync(templatePath, 'utf8'); res.json({ success: true, data: { content: templateContent } }); } catch (error) { console.error('Error reading template:', error); res.status(500).json({ success: false, error: 'Server error while reading template' }); } }); module.exports = router;