0 points

week11_dynamic request response


dashboard

Fri Dec 04 2020 02:21:51 GMT+0000 (UTC)

Posted by @jlang #nodejs,jquery,nodejs #nodejs,jquery

app.get('/:character', (req, res) => { // !'/:variable means we return dynamic value
  // * creates a constant which stores return from request parameter character

  const chosen = req.params.character;

  // What does this log?
  // * console logs the above return from request
  console.log(req.params);
  console.log(chosen);
  // * ends function response
  res.json(chosen);
  res.end();
});
content_copy Copy