const users = [];
formRegister.post("/register", (req, res) => {
const currentUser = req.body;
if (validateFunction(currentUser.email, currentUser.password) === 400) {
res.status(400).send({
message: "Cant Be Empty!",
success: false,
});
} else {
const useExists = users.filter((user) => user.email === currentUser.email);
if (useExists.length > 0) {
res.status(400).send({
message: "This email already registered!",
success: false,
});
} else {
users.push(user);
res.status(200).send(`
<body style="overflow-y:hidden;">
<div style="height:100vh;display:flex;justify-content:center;align-items:center;flex-direction:column">
<h1 style="color:#00C24E font">SUCCESS</h1>
<h4 style="color:#DC3545">${user.email}</h4>
<p>Has added to database succesfuly.</p>
<a href="/getData">Get Other Users</a>
</div>
</body>`);
}
}
});