0
votes

I'm at the final step of making my first JS Web App using Pug, where I need to test that it supports POST method, which takes in a string should return a JSON object with 2 key.value pairs that represent original string and its length.

I'm instructed to use Postman and x-www-form-urlencoded to test my App, but I don't know how to test the POST method using urlencoded body.

Can someone tell me what I should fill in for KEY and VALUE on Postman, under x-www-form-urlencoded?

//POST method in route file
router.post('/', (req, res, next) => {
    res.render('ps3post', {string: req.body.string, stringLength: req.body.string.length});
});
block content
    h1 POST method, page rendered by PUG
    p= string
    p= stringLength

My Postman Error Message Screenshot

1

1 Answers

0
votes

Okay I figured it out.. It seems that KEY needs to be type (string in my example), and VALUE needs to be what I want the actually value to be.

Postman Screenshot