I'm new in nodejs. I'm trying to make login form using ejs engine. What I want is simply print the username and password in the welcome screen using post request. The problem is that if I am using POST action it will print my data but don't display the welcome screen layout and if I used GET action then it will display the screen layout but don't have the data. I have wrriten the code in the app.js file. Is it correct?? I've mentioned my app.js code below for reference. Thanks in advance.
Code:-
app.post('/welcome', function(req, res) {
res.send('Username is '+req.body.unm+'<br>Password is '+req.body.pwd);
});
via Yash Parekh
No comments:
Post a Comment