Ashish sah Ashish sah -4 years ago 78
Node.js Question

Not able to use post request in node js

<form class="ui form" action"/submit" method="post">
<div class="field">
<label>Time you gave to your Studies:</label>
<input type="number" name="study" placeholder="Total time given:">
<div class="field">
<label>Time you gave to your <%= prof %> :</label>
<input type="number" name="proffesion" placeholder="total time given for profession">
<div class="field">
<label>Time you gave for Sleeping :</label>
<input type="number" name="sleeping" placeholder="total time spended on Sleeping">
<div class="field">
<label>Time you gave to your games :</label>
<input type="number" name="games" placeholder="total time given for games">
<button class="ui button" type="submit">Submit</button>

this was my form:
and I am using express app.js is the main file and index.js containes routes in which I have few routes'/submit', function(req, res, next) {
var item = {
proffesion: req.body.proffesion,
sleeping: req.body.sleeping,

I am not able to post the form data whenever I click submit button it shows 404 error, What wrong I am doing? , How to make a post request and get the forum data?

Answer Source

What you have:


What you should have:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download