JavaScript Express Basics Parameters, Query Strings, and Modularizing Routes Randomize Cards

my solution

Card.pug

extends layout.pug

block content
    section#content 
        h2= text
        if hint
            p
                i Hint: #{hint}
        a(href=`/cards/${id}?side=${link}`) #{link}

cards.js

const express = require('express');
const router = express.Router();
const { data } = require('../data/flashcardData.json');
const { cards } = data;

router.get('/:id', (req, res) => {
    const {side} = req.query;
    const { id } = req.params;
    const text = cards[id][side];
    let templateData = { id, text};

    if( side === 'question' ){
        templateData.hint= cards[id].hint;
        templateData.link = 'answer';
    } else {
        templateData.link = 'question';
    }



    res.render('card', templateData);
});

module.exports = router;