Suppose I want to see an input, say name is set in a form in php, I can do this:
if (isset($_POST['name']) {
echo("type in name"); # or something
}
Can I do something like that in nodejs this way:
router.get('/', function (req, res, next) {
if (req.body.name == "") {
res.send('type in name'); // or something
}
});
I'm new to both php and nodejs, so can someone clarify this for me, or provide me with a better/correct solution in nodejs?
I don't want to check if some object has some property, but if the form submitted has the property name set, i.e name is non empty.