How to pass form data to controller via router?

Multi tool use
How to pass form data to controller via router?
I have a simple form in index.ejs
<form action="/products/create" method="POST">
<input type="text" placeholder="name" name="name">
<input type="text" placeholder="quote" name="quote">
<button type="submit">Submit</button>
</form>
I have to post this form to database via routes to controller.
I have a product.router.js like below:
router.post('/create', product_controller.product_create);
and inside product_controller function:
exports.product_create = function (req, res) {
let product = new Product(
{
name: req.body.name,
price: req.body.price
}
);
product.save(function (err) {
if (err) {
return next(err);
}
res.send('Product Created successfully');
});
};
Before I was using postman to insert. But now I am trying to post from form. I am a beginner in node js.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.