app.post() not working with Express app.post() not working with Express express express

app.post() not working with Express


I don't find any issue with app.post code !!

app.post('/login', function(req, res){    console.log('test');    res.end(); // end the response});

One suggestion is that you should end each response send to client , otherwise your server become unresponsive.


Your post request is send to /test ( since you've used action attribute of your form ), while your express listener is listening to any post requests on /login.

Your code should look like :

block content  h1 Login  h3 "tj" and "foobar"  form(method="post", action="/login")

If you want this to work!


I copy 'router.post()...' to another js file,and change the route in app.js,it worked!But 'router.post()' method still a warning.sometimes it seems like a warning in webstorm,but it can actually work!