codex-lv3-may-2025

Level Navigation: 1 2 3 4 5 6 7 8 9 10⚡ 11⚡ 12⚡ 13⚡ 14⚡ 15 16 17 18⚡ 19 20

Level 6: Server Route for Form Processing

User Story: As a developer, I want to create a server route so that I can receive and process the form data when users submit their Mad Libs.

What You’ll Do

Create a server route to handle form submission and process the form data.

Instructions

💡 Code Hints

Need help with routes? Check out these snippets:

Show Me: basic route structure
app.get('/create-mad-libs', (req, res) => {
    // Access form data here
    console.log('Form submitted!');
    res.send('Form received!');
});
Show Me: accessing form data
app.get('/create-mad-libs', (req, res) => {
    const name = req.query.name;
    const adjective = req.query.adjective1;
    
    console.log('Name:', name);
    console.log('Adjective:', adjective);
    
    res.send('Data received!');
});

✅ Check

  1. Fill out your form and submit it
  2. Check your server console for logged form data
  3. You should see all form fields logged with their values
  4. If you don’t see the data, check your route and form action