Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

jason limmm
jason limmm
8,009 Points

link submit a form leading an error

here is my js

router.get('/', (req, res)=>{
    res.render('ask');
});

router.post('/thankyou', (req, res)=>{
    res.cookie('name', req.body.name);
    res.render('thankyou');
});

my pug

    form#Name(action='/thankyou', method='post')
        label(for='name') Name:
        input#name(type='text', name='name' , placeholder='john doe')
        button(type='submit') Submit

i think i can post to a different route name just so long as i set the action of the form to the given post route name

i tried posting to the same route name by the way but it didn't work