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

router.post('/echo', (req, res) => {
    const { name } = req.body;
    res.json({ message: `Hello, ${name}` });
});

router.get('/find-magic-text', (req, res) => {
    const result = { name: 'Magic Text', value: 'abc123' };
    res.json(result);
});

router.get('/ruleset', (req, res) => {
    const filePath = path.join(__dirname, '../public/rulesets/2-debugging-ruleset.json');
    res.download(filePath, '2-debugging-ruleset.json');
});

router.post('/form-fix', (req, res) => {
    res.status(204).send();
});

router.get('/status-code', (req, res) => {
    res.status(400).send();
});

module.exports = router;
