I have input for username and password, when user click submit, they are sent with POST method, and when node.js receives them, they will be put in constructor class, something like this:
app.post('submit1', (req, res) => {
var data = req.body;
new User(data);
res.send(i want to send response if that bellow is true)
})
After that, in class User, there is a function loginClient(data), and inside that function is function for verification waiting for some emit, and it that functions receives that emit, username and password are correct, and I want to replay to that 'submit1'.. How can I do this?
class User {
loginClient(data){
this.somthing.on('thatEmit', () => {
"send response because this function got that emit"
});
}
}
question from:
https://stackoverflow.com/questions/65879736/get-post-request-node-js 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…